当前位置: 首页 > 工具软件 > nginx-ui > 使用案例 >

nginx swagger-ui 问题备忘

岳研
2023-12-01

假设 spring boot 使用的端口为 8888

nginx 将请求转至 8888,

如下配置会导致 swagger-ui 网页内的请求失效:

        location / {
            proxy_pass http://127.0.0.1:8888/;
        }

增加如下一行,可解决问题:

        location / {
            proxy_set_header Host $host:$server_port; 
            proxy_pass http://127.0.0.1:8888/;
        }

如果是匹配  /test ,则以下配置swagger-ui 使用 仍然是有问题的,暂不知道如何解决。

        location /test {
            proxy_set_header Host $host:$server_port; 
            proxy_pass http://127.0.0.1:8888/;
        }

 类似资料: