Skip to content

Commit d277cd6

Browse files
authored
Update proxy.js
comment
1 parent 2e8add5 commit d277cd6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

‎api/proxy.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
const { createProxyMiddleware } = require("http-proxy-middleware");
22

33
module.exports = (req, res) => {
4-
let target = "https://www.google.com/";
5-
// 代理目标地址
6-
// 这里使用 backend 主要用于区分 vercel serverless 的 api 路径
4+
let target = "https://www.google.com/";//your website url
75
// if (
86
// req.url.startsWith("/api") ||
97
// req.url.startsWith("/auth") ||
@@ -13,13 +11,12 @@ module.exports = (req, res) => {
1311
// target = "http://106.15.2.32:6969";
1412
// }
1513

16-
// 创建代理对象并转发请求
1714
createProxyMiddleware({
1815
target,
1916
changeOrigin: true,
2017
pathRewrite: {
21-
// 通过路径重写,去除请求路径中的 `/backend`
22-
// 例如 /backend/user/login 将被转发到 http://backend-api.com/user/login
18+
// rewrite request path `/backend`
19+
// /backend/user/login => http://google.com/user/login
2320
// "^/backend/": "/",
2421
},
2522
})(req, res);

0 commit comments

Comments
 (0)