nginx开发环境代理webstorm和springboot项目配置

nginx开发环境代理webstorm和springboot项目配置,第1张

nginx开发环境代理webstorm和springboot项目配置

为了解决跨域问题,真实模拟未来实地程序部署形态,在开发机器上配置nginx分别代理vue前端和springboot后台项目,配置参数如下:

        location / {
          add_header Cache-Control 'no-store, no-cache'; #// 设置不缓存
          proxy_pass http://127.0.0.1:9527;
        }
       
		location ^~ /xxx/api/ {
 			rewrite  ^.+xxx/api/?(.*)$ / break;
            include  uwsgi_params;			      
			proxy_pass http://127.0.0.1:8082/xxx/;			      
	    }

location /  配置为无条件转发给webstorm跑的9527端口

location ^~ /xxx/api  配置为代理后台springboot项目的代理路径,因为后台springboot项目上下文路径名称叫xxx,所以这里还需要对/xxx/api的请求路径做个重写替换。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5076570.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-16
下一篇 2022-11-16

发表评论

登录后才能评论

评论列表(0条)

保存