本文介绍: vue代理方式在不加 replace(“/sign-system“, “”) 的时候,是将标识符追加到target后边;当加 replace(“/sign-system“, “”) 语句后,原理则与nginx方式相同。
nginx代理方式
例如:当浏览器请求的路径是 localhost:80/order/get,检测到请求路径里的/order/
的时候proxy_pass
将代替这个标识符之前(包括标识符)的内容。也就是说访问的是 localhost:8080/order/get。
location后边的字段拦截的是公用前缀。在这里后端接口为/order/get,proxy_pass为http://localhost:8080/order ,如果后台接口为/get,那么proxy_pass为http://localhost:8080。
location api/order/ {
proxy_pass http://localhost:8080/api/order/
VUE代理方式
总结
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。