301 Redirect - how to set it up?

Hi there, quick context: I've deployed my dash app with Railway and I've set up on Namecheap a 301 redirect from @ to www version of the site. In railway, I've two custom domains. xxxx.com and www.xxxx.com . The redirect I've set up in Namecheap doesn't seem to work. Is it because the redirect needs to be actually set up in Railway? how to do so?
Solution:
how about using this: https://github.com/brody192/domain-redirect-template that you made?...
GitHub
GitHub - brody192/domain-redirect-template
Contribute to brody192/domain-redirect-template development by creating an account on GitHub.
Jump to solution
13 Replies
Percy
Percy11mo ago
Project ID: 80fbd5c7-d9ed-48ff-b158-c17bad8043e2
djskarpia
djskarpiaOP11mo ago
80fbd5c7-d9ed-48ff-b158-c17bad8043e2 projectID
Brody
Brody11mo ago
the redirect is something you would need to setup at the dns level (i dont think namecheap's redirect is sufficient) or something you would need to do in your app itself
djskarpia
djskarpiaOP11mo ago
I actually spoke with Namecheap. They only support 301 redirect between http but not https. The https redirect needs to be done via server. Any idea how can I do it via Railway?
Brody
Brody11mo ago
you would need to do in your app itself
likely with a middleware
Solution
djskarpia
djskarpia11mo ago
how about using this: https://github.com/brody192/domain-redirect-template that you made?
GitHub
GitHub - brody192/domain-redirect-template
Contribute to brody192/domain-redirect-template development by creating an account on GitHub.
Brody
Brody11mo ago
thats a little more complex than what you need
djskarpia
djskarpiaOP11mo ago
I'm not super knowledgeable but if I deploy it and point with custom domain @ my domain, then the caddy service will do the redirect for me though no?
Brody
Brody11mo ago
what kind of app are you running?
djskarpia
djskarpiaOP11mo ago
plotly dash app
Brody
Brody11mo ago
does that framework not provide you with a way to add a middleware to all incoming requests?
djskarpia
djskarpiaOP11mo ago
nope but I actually achieved what I needed thanks to your service. I've simply deployed the caddy service on the non www domain and the redirect is set to go to www.mydomain. It's doing what I need by doing a curl, I receive a 301
No description
Brody
Brody11mo ago
okay perfect
Want results from more Discord servers?
Add your server