nginx 为什么kartoza/geoserver不能让我登录?

kxeu7u2r  于 2022-12-11  发布在  Nginx
关注(0)|答案(1)|浏览(213)

I have kartoza/geoserver that I start with this docker-compose:

version: "3.9"
services:

  geoserver:
    image: kartoza/geoserver
    environment:
      - GEOSERVER_ADMIN_USER
      - GEOSERVER_ADMIN_PASSWORD
      - GEOSERVER_CSRF_DISABLED=true
      - JAVA_OPTS
      #- PROXY_BASE_URL

running behind Nginx with these configurations:

server {
        listen 80 default_server;
        listen [::]:80 default_server;
        server_name _;
        return 301 https://$host$request_uri;
}

server {
        listen 443 ssl;
        listen [::]:443 ssl;
        server_name geos.mydomain.com;
        ssl_certificate /etc/nginx/ssl/cert/geoserver/geoserver.crt;
        ssl_certificate_key /etc/nginx/ssl/cert/geoserver/geoserver.rsa;

        location /geoserver/ {
                proxy_pass http://geoserver:8080/geoserver/;
                proxy_pass_header Set-Cookie;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

}

I can see the geoserver page:

But when I try to login it fails:

Why? How can I solve it?

s3fp2yjn

s3fp2yjn1#

As mazano said:
Looks like you are running with HTTPS so you need to set the following env variables

HTTP_PROXY_NAME=foo.org HTTP_SCHEME=https

after setting these variables everything works fine!

相关问题