Like the title says, a curl request to the following server written for appengine with GO doesn't switch from POST to GET despite the redirection :
func init() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
fmt.Fprintf(w, "INDEX")
case "POST":
fmt.Print("redirecting...")
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
default:
http.NotFound(w, r)
}
})
}
Instead, I get an infinite redirection loop, no matter what status code I try (302,303,...)
My routing in app.yaml for the record :
- url: /.*
script: _go_app
And the curl command used locally :
curl "http://localhost:8080" -X POST -L
How do I fix this ? thanks .
EDIT: The behavior remained unchanged with 302
http.Redirect(w, r, "/", http.StatusFound)
It is still stuck in a redirection loop