redirected you too many times (ERR_TOO_MANY_REDIRECTS)

syed nginx-forum at forum.nginx.org
Mon Sep 30 20:02:48 UTC 2019


Hello Techs,
I have an issue setting up the load balancing for my Jboss application. I
have issue with the website load and i need to set up another server which
would take the load and serve the application from another server as well.
I've set up an Upstream to redirect the traffic to other server but the
issue I get is as below once i start application on both the servers.

my.domain.com redirected you too many times.
ERR_TOO_MANY_REDIRECTS




My setup is as below for your reference. Your kind help is much appreciated
at the earliest.



#
# The default server
#

#
upstream COM {
     server localhost:8080;
     server  Remote server:8080; 
     keepalive 100;
   }



server {
    listen       80;
    #listen       [::]:80 default_server;
    server_name  my.domain.com;
      client_max_body_size 500M;
      server_tokens off;

   # root         /usr/share/nginx/html;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;


    location / {
         if ($uri !~ "^/(EbreezCorp/.*)$"){
           set $rule_0 1$rule_0;
         }
        if ($rule_0 = "1"){
        rewrite ^/(.*)$ /EbreezCorp/corp/ta/FlyinTa$1 break;

        }
        
        
	    
       proxy_pass http://COM/;
       proxy_connect_timeout       300;
       proxy_send_timeout          300;
      proxy_read_timeout          300;
      send_timeout                300;
      proxy_pass_header Server;
      proxy_pass_header 'FlyinCOM';
      add_header X-Content-Type-Options "nosniff";
      proxy_cookie_path / "/EbreezCorp; Secure; HTTPOnly;";
   	   
     }



    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }





}
####################################################################################

Now, if I remove the Upstream and use the configurations below, it just
works fine with the single server which doesn't suffice my requirement.



#
# The default server
#

#

server {
    listen       80;
    #listen       [::]:80 default_server;
    server_name  192.168.x.x;
      client_max_body_size 500M;
      server_tokens off;

   # root         /usr/share/nginx/html;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;


    location / {
         if ($uri !~ "^/(EbreezCorp/.*)$"){
           set $rule_0 1$rule_0;
         }
        if ($rule_0 = "1"){
        rewrite ^/(.*)$ /EbreezCorp/corp/ta/FlyinTa$1 break;

        }
	   
       proxy_pass http://192.168.x.x:8080;
       proxy_connect_timeout       300;
       proxy_send_timeout          300;
      proxy_read_timeout          300;
      send_timeout                300;
      proxy_pass_header Server;
      proxy_pass_header 'FlyinCOM';
      add_header X-Content-Type-Options "nosniff";
      proxy_cookie_path / "/EbreezCorp; Secure; HTTPOnly;";
   	   
     }



    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }





}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,285759,285759#msg-285759



More information about the nginx mailing list