4

I have a Django site on Heroku with Dnsimple to manage DNS. I am also using Django to force HTTPS.

I am trying to follow google protocol so that I only have one domain

https://example.com

So that if a user visits http://www.example.com or https://www.example.com it will redirect to https://example.com

My settings in Dnsimple look like this:

ALIAS   example.com     example.com.herokudns.com
CNAME   www.example.com  example.com.herokudns.com

I tried deleting the cname and using the URL redirect in Dnsimple, but it isn't working.

What is the correct way to do this redirect? I've tried creating a middleware based on another outdated post, but it crashed my site.

John Rogerson
  • 1,153
  • 2
  • 19
  • 51
  • Same problem here. Did you find any solution? – J0ANMM Apr 10 '18 at 12:31
  • 1
    Hi yes you need to create custom middleware in Django as Dnsimple does not handle redirect of https addresses. Follow this post here https://stackoverflow.com/questions/12759030/heroku-django-redirect-all-requests-for-www-to-root-domain/46233639#46233639 – John Rogerson Apr 10 '18 at 13:15

0 Answers0