0

I have a view (Let's call it handle_login_redirection) that handles log-in from a url and redirects to an appropriate url based on the request. This has been working fine.

Now when I use a custom domain and add the r'^$' pattern to my urlconf so that the Top Level Domain (TLD - www.mysite.com) is redirected to the same view that handles login (i.e handle_login_redirection), I can see that the urls are not rewritten in the browser even when the page is correctly redirected.

Even other urls on the site, while they are directed fine, do not change to their corresponding url path and instead show the TLD in the browser. Is there anything wrong with the url pattern or is there a better way to handle TLD redirects?

Also note, I'm deployed to Heroku and there is no Nginx,Apache to configure url rewrites.

Pratik Mandrekar
  • 9,362
  • 4
  • 45
  • 65

1 Answers1

0

So I was doing domain forwarding and masking which was causing the issue. The right way to do this is to set CNAME entry source to point from your subdomain (www.mysite.com) to mysite.herokuapp.com (for Cedar stack). Also had to make entries for A records for naked domains i.e mysite.com (Without the www) and point that to mysite.herokuapp.com

And then running heroku domains:add <domain> on both the domain and the sub-domain.

Helped by How to configure heroku application DNS to Godaddy Domain? and https://devcenter.heroku.com/articles/custom-domains

Community
  • 1
  • 1
Pratik Mandrekar
  • 9,362
  • 4
  • 45
  • 65