Spring boot 使用Nginx反向代理访问SpringBoot Rest API时出现问题
我有一个spring启动应用程序。当我通过EclipseIDE运行spring应用程序并通过localhost:8080/api访问它时,我得到了Swagger页面和所有正确的信息 然而,当我试图通过nginx反向代理(localhost:80/test/api)访问在eclipseide上运行的应用程序时,它显示的是404。当我在RestController中将api路径更改为/test/api时,我可以访问该页面 下面是我的nginx配置Spring boot 使用Nginx反向代理访问SpringBoot Rest API时出现问题,spring-boot,nginx-reverse-proxy,Spring Boot,Nginx Reverse Proxy,我有一个spring启动应用程序。当我通过EclipseIDE运行spring应用程序并通过localhost:8080/api访问它时,我得到了Swagger页面和所有正确的信息 然而,当我试图通过nginx反向代理(localhost:80/test/api)访问在eclipseide上运行的应用程序时,它显示的是404。当我在RestController中将api路径更改为/test/api时,我可以访问该页面 下面是我的nginx配置 location /test/ { set $tes
location /test/ {
set $testapi test-api;
#proxy_pass http://$testapi:8080; --This one is for other environment
proxy_pass http://host.docker.internal:8080; - When nginx is running locally in a container.
include nginx-route-ws-proxy-settings.conf;
}
我无法理解,当我尝试访问localhost:80/sb/api时,它显示的是404。它重定向到的是谁http://localhost:80/login 因此,nginx无法识别此路径。这里少了一些东西。这是我无法得到的。有人能提出解决办法吗