Hi,

Sorry not expert on this, but we are running NGINX + GeoServer with these proxy 
and geoserver specific settings (+ many others).

        proxy_set_header Host $host;
        proxy_pass_header Set-Cookie;
        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 X-Forwarded-Host $host;

                
        # Redirect to GeoServer 
        location /geoserver/ {
            proxy_pass http://127.0.0.1:8080/geoserver/;        
        }


Best regards,
Kylli Ek

GIS-coordinator
CSC - IT Center for Science Ltd
PL 405, 02101 Espoo
Tel: +358 50 38 12 838
gisco...@csc.fi

----- Original Message -----
From: "Karl Vollmer" <karl.voll...@dal.ca>
To: "geoserver-users" <geoserver-users@lists.sourceforge.net>
Sent: Tuesday, 29 August, 2023 20:13:18
Subject: [Geoserver-users] Geoserver Container behind NGINX Proxy (SSL) endless 
redirect loop

I just spun on the latest stable geoserver container, it's front-ended by a 
NGINX proxy using SSL. Initial connections created an endless redirect loop. 
Has anyone else encountered this? From what I can tell it's being caused by 
Geoserver itself. 

NGINX Rules

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

In Geoserver I've set "Use Headers for Proxy URL" and even for kicks restarted 
the container after it's been applied. The result is that the geoserver web app 
never stops sending new redirects. 

GET /geoserver/
REDIRECT /geoserver/web
GET /geoserver/web
REDIRECT /geoserver/web/?10
GET /geoserver/web/?10
REDIRECT /geoserver/web/?10?0%3F0

and so on, ending only when the URL length/redirect limit is exceeded. 
Containers logs show the proper headers are being send to the geoserver 
instance by NGINX, but in the browser after each GET request geoserver returns 
a redirect, with an appended value. (geoserver not NGINX). 

Tunnelling the internal port locally, and hitting it directly works perfectly. 
Removing SSL also works flawlessly. Of note the returned redirects are 
incorrect they are http://$host instead of https://$host. The redirect for http 
-> https is rewrite ^ https://$host$request_uri permanent;

Any help is appreciated. 

-Karl

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to