Domain not working
hadiassaddiab
HOBBYOP

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

hadiassaddiab
HOBBYOP

2 years ago

ef2ad333-4cf8-4885-97b8-7c857b9171d0


2 years ago

Are you using Cloudflare?


hadiassaddiab
HOBBYOP

2 years ago

No


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


hadiassaddiab
HOBBYOP

2 years ago

No, I am not sure. Is there any way to check / fix it


2 years ago

You can check by looking at your app's code, how is it handling requests to /?


hadiassaddiab
HOBBYOP

2 years ago

It returns a page


hadiassaddiab
HOBBYOP

2 years ago

the index page


hadiassaddiab
HOBBYOP

2 years ago

path("", views.home, name="home"),

I just changed it to:

path("/", views.home, name="home"),

hadiassaddiab
HOBBYOP

2 years ago

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


hadiassaddiab
HOBBYOP

2 years ago

This change did not make a difference


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


hadiassaddiab
HOBBYOP

2 years ago

Thank you so much


hadiassaddiab
HOBBYOP

2 years ago

That seems to have been the issue


hadiassaddiab
HOBBYOP

2 years ago

Everything is working perfectly now


2 years ago

Awesome!


Loading...