NGINX不代理子路径

时间:2019-10-31 03:16:21

标签: nginx proxypass

我无法让服务器将子路径代理到proxy_path值。

如果我尝试转到https://localhost/services/app/gui,则它不会在代理服务器的/gui上转发。

服务器正在https://192.168.1.223:8020/gui正常运行,但是一直显示默认的Spring Boot Whitelabel Error Page

server {
    listen 80;
    listen 443 ssl http2 default_server;
    server_name localhost;
    index index.html;

    #
    # Proxy 2-way SSL connections (i.e., client pki cert) to AWS-based services
    #
    location ^~ /services/app/(.*) {
        proxy_buffers 16 50k;
        proxy_buffer_size 25k;
        proxy_pass       https://${HOST_EXTERNAL_IP}:${WEBPACK_PORT};
        proxy_set_header USER_DN $ssl_client_s_dn;
        proxy_set_header Host      $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    location = / {
        rewrite ^/$ /services/app redirect;
    }

    location / {
        proxy_http_version  1.1;

        proxy_set_header    Connection "keep-alive";

        proxy_pass       https://${HOST_EXTERNAL_IP}:${PORT};
        proxy_ssl_verify off;
    }

    < ... snip ... >

}

0 个答案:

没有答案