ERR_TOO_MANY_REDIRECTS using Nginx and Application load balancer

jp flag

I have set up an ALB on AWS with a certificate to redirect traffic over https, in my target group I have a Nginx to do a proxypass with my target instances.

Currently I have a CAS 4.0.1 application deployed in one instance, when I use the IP it works perfectly, but behind nginx I get ERR_TOO_MANY_REDIRECTS.

My Nginx has the following configuration:

server {
    listen 80;
    proxy_set_header X-Real-IP $remote_addr;
    absolute_redirect off;
    if ($http_x_forwarded_proto != 'https'){
           return 301 https://$host$request_uri;

location /cas {
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Server $host;

Is there a line that fix my issue?


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.