a year ago
I deployed my backend and database in the railway platform and when I tried to access my backend through an HTTPS request I got a message of Mixed Content HTTPS to HTTP, every time, my .env is configured with HTTPS URL, but I got that problem, and I want to know why in the curl I'm getting a code 307 Temporary redirect from my project, this is happening in railway deployment, I deployed in render platform too and works fine, but in railway not. thanks for your help
3 Replies
a year ago
When on Railway your application is ran behind a proxy that terminates HTTPS for you, so by the time the traffic reaches your app it is HTTP.
What I think is going on - your app is seeing that the incoming requests are HTTP and is trying to do the secure redirect.
If this is the case, you have about two options -
Outright stop your app from doing that redirect, let it accept HTTP traffic since Railway handles HTTPS and insecure redirects for you.
Let your app know that it is running behind a secure proxy, if it knows the traffic is already secure it won't attempt a redirect.
a year ago
thanks a lot, I did this little change adding "--forwarded-allow-ips='*'" in my deploy FastAPI start command and works
uvicorn main:app --host 0.0.0.0 --port 8000 --forwarded-allow-ips='*'
Status changed to Solved brody • over 1 year ago
