godemo icon indicating copy to clipboard operation
godemo copied to clipboard

csrf set in main package

Open ferluk opened this issue 6 years ago • 1 comments

dont you add this setting ?

`func main() { r := gin.Default()

 csrf := nosurf.New(r)
 csrf.SetFailureHandler(http.HandlerFunc(csrfFailHandler))

 http.ListenAndServe(":8000", csrf)

}

func csrfFailHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "%s\n", nosurf.Reason(r)) } `

ferluk avatar Apr 17 '18 02:04 ferluk

@ferluk Thank you for your suggestion.

I omitted nosurf handler by this commit. Because it rejected API request by SCRF protection. It's not expected(uncompleted) behavior.

If you fix this problem, please feel free to send pull request.

Leko avatar Apr 17 '18 12:04 Leko