My flask app is doing a 301
redirect for one of the urls.
The traceback in New Relic is:
Traceback (most recent call last):
File "/var/www/app/env/local/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request
rv = self.dispatch_request()
File "/var/www/app/env/local/lib/python2.7/site-packages/flask/app.py", line 1336, in dispatch_request
self.raise_routing_exception(req)
File "/var/www/app/env/local/lib/python2.7/site-packages/flask/app.py", line 1319, in raise_routing_exception
raise request.routing_exception
RequestRedirect: 301: Moved Permanently
It doesn't look like it is even hitting my code or rather the traceback isn't showing any of my files in it. At one point I did have Nginx redirect all non SSL request to HTTPS but had to disable that as Varnish was not able to make the request to port 443
with out an error... probably some configuration that I did or didn't make.
It doesn't always return a 301
though, I can request the URL and get it without any trouble. But someone out in the world requesting the URL is getting a 301
response.
It is a GET
request with some custom headers to link it to the account.
At no point in my code is there a 301
redirect.
The traceback shows that it was the route matching that raised a redirect; usually (e.g. unless you added explicit redirect routes), that means the client tried to access a branch URL (one that ends with a trailing slash), but the requested URL did not include the last slash. The client is simply being redirected to the canonical branch URL with the slash.
From the Werkzeug
Rule
documentation:From the routing documentation:
As documented, if you do not want this behaviour (and have the url without the trailing slash be a 404 Not Found instead), you must set the
strict_slashes=False
option on your route.