Redirecting HTTPS

Issue

You want to redirect requests from an https root domain to another.

Resolution

A common scenario is that you want to redirect requests from an apex/root domain like example.com to www.example.com - this can often be performed at your DNS provider level if they offer that service.

However, if you want to redirect requests made to https://example.com on to https://www.example.com then you may see failures. This is often because your DNS provider does not have a valid certificate for your domain so when a browser makes a request to https://example.com the request will fail.

In this scenario you may need to change your DNS provider. To one that either supports https redirects, or that supports ANAME/ALIAS records so the record can be configured to point directly to your application which could then be configured with a valid certificate. You can then handle the redirect at the application level.

Relevant articles: https://help.heroku.com/J2R1S4T8/can-heroku-force-an-application-to-use-ssl-tls

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support