R
Railway7mo ago
Tim

NS_ERROR_REDIRECT_LOOP

I am running a Django server using a docker file. Project id a9861a99-1c51-4b34-8970-6e92d5cd7f47 The deploy log states that the gunicorn started succesfully, but I get an infinite redirect cycle when I try to access the website? Any suggestions how to avoid this? I don't have this problem on localhost. So I am getting 301's to the same url looped.
Installed 62 object(s) from 13 fixture(s)
[2023-11-25 13:55:02 +0000] [16] [INFO] Starting gunicorn 21.2.0
[2023-11-25 13:55:02 +0000] [16] [INFO] Listening at: http://0.0.0.0:6429 (16)
[2023-11-25 13:55:02 +0000] [16] [INFO] Using worker: sync
[2023-11-25 13:55:02 +0000] [18] [INFO] Booting worker with pid: 18
Installed 62 object(s) from 13 fixture(s)
[2023-11-25 13:55:02 +0000] [16] [INFO] Starting gunicorn 21.2.0
[2023-11-25 13:55:02 +0000] [16] [INFO] Listening at: http://0.0.0.0:6429 (16)
[2023-11-25 13:55:02 +0000] [16] [INFO] Using worker: sync
[2023-11-25 13:55:02 +0000] [18] [INFO] Booting worker with pid: 18
4 Replies
Percy
Percy7mo ago
Project ID: a9861a99-1c51-4b34-8970-6e92d5cd7f47
Fragly
Fragly7mo ago
are you using cloudflare proxy?
Tim
Tim7mo ago
No Hmm it appears to be a consequence of SECURE_HSTS_PRELOAD=True
Brody
Brody7mo ago
your app runs in http mode and sits behind railway's https proxy, but your app isn't aware of that https proxy so it will always keep trying to redirect to https thus resulting in the infinite redirect. you can disable all http -> https redirects on your apps side of things because railway will not allow external access from anything but https anyways.