I have a NodeJS app deployed on Digital Ocean, with a domain attached to it.
The app is hosted under https://www.myapp.com
I would like to redirect https://myapp.com to https://www.myapp.com
However, The DNS is managed by Digital Ocean. I can add records, but the record “name” is automatically pre-fixed with
So how can I achieve this redirect?
Thank you, Klaas
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $200 of credit to try our products over 60 days!
I believe that this should be doable as you are already using DigitalOcean for your DNS management:
In this example, we create a middleware that checks if the incoming request’s hostname is
example.com. If so, it redirects the request to
www.example.comwith a 301 redirect status code.
Let me know how it goes!