Gunicorn + Flask (ERR_TOO_MANY_REDIRECTS):
project_id: 51e075bf-103a-45f2-b2bf-41354422cbfd
Hi there,
I've got a Flask app serves by Gunicorn. The start command is this one:
gunicorn --limit-request-line=15000 --worker-class=gevent manage:app
But when I try to access it via the Railway public domain I've got ERR_TOO_MANY_REDIRECTS. Any clue on this ?Solution:Jump to solution
Just to give you some updates on this:
I manage to resolve this problem by putting
--forwarded-allow-ips="*"
option within the Gunicorn launch command. Here is the doc....7 Replies
Project ID:
51e075bf-103a-45f2-b2bf-41354422cbfd
this probably sounds like a code issue? when your code accidently loops redirects
could you show me the python code that's responsible for ur endpoint
yeah I've seen this before, it's your code trying to redirect to a non https url and then railway redirecting you back to https, and so on.
My route is simple as that !
![No description](https://cdn.answeroverflow.com/1167127493208182865/image.png)
your own code that you wrote is not sending the redirect, it would be the framework
for example, maybe the framework is redirecting non trailing slash routes to routes with trailing slashes, and in doing so is redirecting to a location without https
maybe there is a way to tell gunicorn / flask to trust the proxy so that it knows the incoming requests are made with https
definitely look into that
Solution
perfect, that's exactly what I was getting at