2 years ago
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
18 Replies
2 years ago
Are you using Cloudflare?
2 years ago
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?
2 years ago
going to / returns a 301 redirecting to /, resulting in an infinite loop, causing you to reach too many redirects
2 years ago
You can check by looking at your app's code, how is it handling requests to /?
path("", views.home, name="home"),I just changed it to:
path("/", views.home, name="home"),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
2 years ago
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
2 years ago
if you're using gunicorn then make sure that SECURE_HSTS_PRELOAD is not set to true
2 years ago
Awesome!