nginx 解决前端跨域问题

对 ~/apis/ 的请求,会被代理到 http://www.b.com/。例如

www.a.com/apis/login => www.b.com/login


server {        listen       80;        server_name  www.a.com;        access_log  logs/test.access.log;        # 匹配以/apis/开头的请求 location ^~ /apis/ { proxy_pass http://www.b.com/; #注意域名后有一个/ } location / { root html/a; index index.html index.htm; } # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }复制代码
相关文章
相关标签/搜索