ue部署服务器后,请求地址统一配置加了‘/api’前缀
要访问三方接口地址:http://10.10.10.25:8080/IntellLinkPf/GetChainSummary
vue的请求多了/api:http://10.10.10.25:8080/api/IntellLinkPf/GetChainSummary
修改nginx代理配置解决:
#代理方式 location /api/IntellLinkPf/ { proxy_pass http://202.14.69.26:18720/IntellLinkPf/; #最后增加'/IntellLinkPf/',代理后地址移除了'/api' } #重写方式 location ~ ^/api/ { rewrite ^/api/(.*) /$1 break; #移除了'/api',$1表示正则中括号匹配到的串 proxy_pass http://202.14.69.26:18720; }
