#/connection/* 请求,都会代理到本地
location /connection/ {
proxy_pass http://localhost:28098/connection/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
1.在nginx.conf中增加以上配置;
2.服务器属性配置

/**
*
* @return
*/
@GetMapping({"/connection/google"})
public String google(TestData testData) {
System.out.println(testData);
return "redirect:https://wwww.demo.com/connection/redirect";
}
/**
*
* @return
*/
@GetMapping({"/connection/redirect"})
public String redirect(TestData testData) {
System.out.println(testData);
return THEME + "/index";
}
这样在浏览器输入连接就能debug进入本地进行调试
本文介绍如何在Nginx中配置代理规则,将特定请求转发至本地服务,以及通过SpringMVC控制器实现请求处理与调试流程。通过在nginx.conf中添加配置,可以实现对/connection/*路径的请求代理至本地指定端口,配合SpringMVC的GetMapping注解,完成从外部请求到本地调试环境的无缝对接。
1万+

被折叠的 条评论
为什么被折叠?



