关于跨域这一块

关于跨域这一块

const proxy = require("http-proxy-middleware")


module.exports = (app) => {
    app.use("/ajax", proxy({

        target: "http://39.105.204.151:3000",/*带理地址*/

        changeOrigin: true,
        pathRewrite: {
             "^/ajax": ""
        }
    }))
}
 
 
 
 
 
 
 1 const proxy = require("http-proxy-middleware")
 2 
 3 
 4 module.exports = (app) => {
 5     app.use("/ajax", proxy({
 6         target: "http://39.105.204.151:3000",
 7         changeOrigin: true,
 8         pathRewrite: {
 9              "^ajax": ""
10         }
11     }))
12 }
View Code
原文地址:https://www.cnblogs.com/Bree/p/12003698.html