Forums

POST returns a 301 for some requests; 200 for others

Hi folks,

Wonder if you could help here. I've set up an endpoint to receive push notifications from a service I'm using. When I test the POST endpoint myself in Curl I get a 200. When I trigged a post from their test website, I see a 301 in the logs:

[IP REMOVED] - - [17/Jun/2016:16:36:06 +0000] "POST /my-test-endpoint HTTP/1.1" 200 29 "-" "curl/7.43.0" [IP REMOVED] 
[IP REMOVED] - - [17/Jun/2016:16:37:35 +0000] "POST /my-test-endpoint HTTP/1.1" 301 319 "-" "-" [IP REMOVED]

Unfortunately I can't see the content of the post they send me. Their request doesn't seem to hit my Flask app at all, so I thought maybe some nginx rule was sending them a redirect? From the logs above, I notice that they don't send a user agent string - could that be an issue with some rule maybe?

<br>

301 is a permanent redirect. Curl may be following the redirect, but I think the default for curl is not to follow redirects.

Thanks for the speedy response Glenn

I didn't set the -L flag in curl so it shouldn't follow any redirects. I think the redirect is happening before flask kicks in. It's a strange one