prs_frontend/src/setupProxy.js
2022-11-10 11:31:43 +08:00

12 lines
518 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { createProxyMiddleware } = require('http-proxy-middleware')
// https://legu-cdn-source.obs.cn-east-2.myhuaweicloud.com
module.exports = function(app){
app.use(
createProxyMiddleware('/pdf',{ //遇见/pdf前缀的请求就会触发该代理配置
target:'https://legu-cdn-source.obs.cn-east-2.myhuaweicloud.com', //请求转发给谁
changeOrigin:true,//控制服务器收到的请求头中Host的值
pathRewrite:{'^/pdf':''}, //重写请求路径(必须)
logLevel: "debug",
}),
)
}