Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

domain.com redirected you too many times #3090

Closed
AustinGilkison opened this issue Mar 10, 2021 · 9 comments
Closed

domain.com redirected you too many times #3090

AustinGilkison opened this issue Mar 10, 2021 · 9 comments
Labels

Comments

@AustinGilkison
Copy link

What happened?

I have recently set up a Django project and am trying to deploy it to production but getting a:

Page isn't working domain.com redirected you too many times

What should've happened instead?

The page should load as it normally did in local.

  • Host system configuration:
    • OS:
      • Amazon Linux 2
@Afrowave
Copy link
Contributor

Hi @AustinGilkison,

Did you assign the domain name when you were setting up the project?

@AustinGilkison
Copy link
Author

@Afrowave Yes, That domain name has been set up.

In order to resolve this I have to remove:

redirect:
      # https://docs.traefik.io/master/middlewares/redirectscheme/
      redirectScheme:
        scheme: https
        permanent: true

From line 48 in compose/production/traefik/traefik.yml

@Andrew-Chen-Wang
Copy link
Contributor

@AustinGilkison Did you wait to get a certificate for users to be able to connect to https in the first place? There's a possibility the certification failed.

@AustinGilkison
Copy link
Author

Yes, The site is using a valid SSL. Once I removed the following from line 48 in compose/production/traefik/traefik.yml everything worked fine.

redirect:
      # https://docs.traefik.io/master/middlewares/redirectscheme/
      redirectScheme:
        scheme: https
        permanent: true

@Andrew-Chen-Wang
Copy link
Contributor

Hm it could be because the Django settings is interfering with traefik? Try going to the http version instead of the https version WITHOUT line 48. Does it redirect? If not, then that's the point of Line 48. If it DOES redirect, then the Django settings may be interfering with the redirect somehow.

Also, you deployed to an EC2 instance but did you put a load balancer from AWS in front of your EC2?

@jcovington16
Copy link

It seems like you are in an infinite loop when trying to redirect. Do you have django.contribs plugins/imports installed? i.e(djagno.contrib.sites, django.contrib.redirects) Have you checked the logs from the web server? I would also ask did you migrate your changes because this will create a django redirect table in your database.

@browniebroke
Copy link
Member

I cannot reproduce from a vanilla project. As other suggested, there might be something else misconfigured outside of the project.

I'm going to close this. You might have more luck on Stackoverflow.

@cjauvin
Copy link
Contributor

cjauvin commented Jan 1, 2022

I am a new django-cookiecutter user so take what I say with a grain of salt, but I was struggling with a similar "too many redirects" issue, and in my case, when I switched my Cloudflare DNS records from "proxied" to "non-proxied", it made it work.

@tkin91e55
Copy link

@cjauvin Saved me a day, I first turned off the redirect in Traefik. But considering complexity, prefer to turn off Cloudflare proxied record.
@browniebroke when I changed on my /etc/hosts, could not reproduce the same problem. I believe this is from "the outside" as you said, Cloudflare proxied record

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants