nginx: mywebsite.intweb.net redirected you too many times. ERR_TOO_MANY_REDIRECTS,

I keep getting this error from nginx when I hit that URL in my broswer, but the part I don't understand is that I don't have any rewrites in my configuration. Also I don't get anything relevant in the error log from nginx. I'm sharing my configuration below:

# Force HTTP requests to HTTPS
    server {
        listen 80;
        server_name mywebsite.intweb.net;
        return 301 https://mywebsite.intweb.net$request_uri;
    }
      server {

      listen  443 ssl;
      root  /var/opt/httpd/lbdocs;

    server_name mywebsite.intweb.net ;

      # add Strict-Transport-Security to prevent man in the middle attacks
    add_header Strict-Transport-Security "max-age=31536000" always;
    ssl_certificate     /etc/pki/tls/certs/star_intweb_net.pem;
    ssl_certificate_key /etc/pki/tls/certs/star_intweb_net.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

      access_log /var/log/nginx/lblogs/https/access.log;
    error_log  /var/log/nginx/lblogs/https/error.log;

   # include rewrites/mywebsite.com.conf;


    index  index.php index.html index.htm;

    # Make nginx serve static files instead of Apache
    # NOTE this will cause issues with bandwidth accounting as files wont be logged
    location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|html|js|css)$ {
        expires max;
    }

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;
         }

    # proxy the PHP scripts to Apache listening on <serverIP>:8080
    location ~ \.php$ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;
         }

    location ~ /\. {
        deny  all;
    }

Thank you

728x90

2 Answers nginx: mywebsite.intweb.net redirected you too many times. ERR_TOO_MANY_REDIRECTS,

This website was able to fix my issue:

The most common misconfiguration that we have come across repeatedly is when a user has incorrect URL in WordPress Address URL or Site Address URL settings.

enter image description here

For example, lets assume that your site’s url is http://www.example.com and you go to Settings » General and set it to http://example.com. Most web hosts allow you to choose whether you would like to add a www prefix to your domain name or have it without www. In case you had selected to add www to your URL, then adding http://example.com in your WordPress settings will cause the error. Or if you opted to use your domain without www prefix, then adding it with www prefix in WordPress settings will cause this error.

If this still doesn't solve the issue, you will have to do a search and replace in the database WP is using.

1 weeks ago

The problem was related to WordPress. I had to edit wordpress wp-config.php file to be https or regular http according to what my nginx configuration was pointing at because otherwise nginx and wordpress keep redirecting to each other and then this error occurs.

5 days ago