Domain not working
Hi. I've created a Django application and tied it to a domain. I've inserted the CNAME Record etc. Railway did not use my domain, despite it claiming to. I then tried to remove my domain, and for some reason, my previously working application no longer works. I get this issue every time I try to visit my website. I tried redeploying, but it did not help. I've tried searching Google for answers, but without luck. Any help is appreciated
Solution:Jump to solution
I have one last idea, make sure your app isn't redirecting http to https
your app is behind Railway's proxy which does https for you and then I think it communicates with your app in http
so if your app redirects http to https then it'll result in a 301 loop...
12 Replies
Project ID:
ef2ad333-4cf8-4885-97b8-7c857b9171d0
ef2ad333-4cf8-4885-97b8-7c857b9171d0
Are you using Cloudflare?
No
the requests are going through Railway, so your client to railway connection is working fine
are you sure your app isn't returning a 301?
going to
/
returns a 301 redirecting to /
, resulting in an infinite loop, causing you to reach too many redirectsNo, I am not sure. Is there any way to check / fix it
You can check by looking at your app's code, how is it handling requests to
/
?It returns a page
the index page
I just changed it to:
However, it would be odd if this is what is causing the problem. I have not changed anything about the pages and it was previously working just fine
This change did not make a difference
Solution
I have one last idea, make sure your app isn't redirecting http to https
your app is behind Railway's proxy which does https for you and then I think it communicates with your app in http
so if your app redirects http to https then it'll result in a 301 loop
if you're using gunicorn then make sure that
SECURE_HSTS_PRELOAD
is not set to trueThank you so much
That seems to have been the issue
Everything is working perfectly now
Awesome!