带有 SSL 和 Nginx 的 Glassfish 适用于应用程序,但不适用于控制台

带有 SSL 和 Nginx 的 Glassfish 适用于应用程序,但不适用于控制台

GF4.1

我的 nginx 配置文件:

upstream glassfish_server {
        server 127.0.0.1:8080 fail_timeout=10;
    }
upstream glassfish_admin {
        server 127.0.0.1:4848 fail_timeout=10;
    }



server {
       listen         80;
       server_name    myserver.com www.myserver.com;
       return         301 https://$server_name$request_uri;
}

server {
        server_name myserver.com;
        listen 443;
        ssl on;
        ssl_session_timeout 5m;
        ssl_protocols SSLv2 SSLv3 TLSv1;
        ssl_certificate  /etc/letsencrypt/live/myserver.com/cert.pem;
        ssl_certificate_key  /etc/letsencrypt/live/myserver.com/privkey.pem;
        ssl_session_cache shared:SSL:10m;

        add_header Strict-Transport-Security max-age=15638400;
        add_header X-Frame-Options DENY;
        add_header X-Content-Type-Options nosniff;

        proxy_set_header Host       $http_host;
        proxy_set_header X-Real-IP  $remote_addr;       

        location /glassfishapp {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
                  proxy_set_header X-Forwarded-Proto https;
            proxy_redirect off;
            proxy_connect_timeout      240;
            proxy_send_timeout         240;
            proxy_read_timeout         240;
                  proxy_pass http://glassfish_server;
        }

        location /adminconsole {
            proxy_pass http://glassfish_admin;

            proxy_connect_timeout       300;
            proxy_send_timeout          300;
            proxy_read_timeout          300;
            send_timeout                300;
            proxy_pass_request_headers on;
            proxy_no_cache $cookie_nocache  $arg_nocache$arg_comment;
            proxy_no_cache $http_pragma     $http_authorization;
            proxy_cache_bypass $cookie_nocache $arg_nocache $arg_comment;
            proxy_cache_bypass $http_pragma $http_authorization;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $host:$server_port; #Very nb to add :$server_port here
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            add_header Access-Control-Allow-Origin *;
            proxy_set_header Access-Control-Allow-Origin *;

            }

}

我可以访问https://myserver.com/glassfishapp, 但https://myserver.com/adminconsole给出 error_too_many_redirects?

我在 Google 上进行了广泛的搜索,发现 gf 控制台的不同配置参数来自:

nginx 反向代理glassfish问题

结果还是一样。帮忙吗?

相关内容