Inconsistent routing behavior #4495
Unanswered
SesamBread
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am currently trying to deploy a Flask application (with waitress) behind Kubernetes and nginx as a reverse proxy and I seem to be getting an inconsistent routing behavior regarding how it is described in the documentation.
Whenever the application reroutes on basis of missing trailing slash it reroutes me to the internal domain url within Kubernetes e.g. server_url.local/page/ and not the external one server_url.com/page/. According to the the documentation setting the SERVER_NAME variable and subdomain_matching=True should enable the right behaviour, which it does for the url_for function with _external=True set but not for the trailing slash routing.
Before setting SERVER_NAME manually I was trying to let the application get the configuration from the nginx X-Forwareded-* headers, but even with the usage of Werkzeugs ProxyFix the error persisted.
As far as I understand a missing trailing slash should throw a RoutingRequest exception, but I cannot see an error_handler set up to handle it in any way within Flask which is why I am not sure as to how exactly the behavior differs from the url_for function.
I would be extremely grateful if someone could help me out or at least clear up why there is a difference between the trailing slash routing and url_for.
Beta Was this translation helpful? Give feedback.
All reactions