Commit 0e833628 by liuxinlin

feat: 修改代理

parent 586ac3f4
HOST=localhost
PORT=3000
PORT=7777
UM_distinctid=1930b610f8be12-00856c472e2e16-1f525636-13c680-1930b610f8c32ce; JESONG_USER_ID=01000000027526106273070665702551; uid=703773; uname=%E6%89%8B%E6%9C%BA%E7%94%A8%E6%88%B7703773; role=3; user_name=%E6%89%8B%E6%9C%BA%E7%94%A8%E6%88%B7703773; avatar_file=https%3A%2F%2Fjulyedu-img-public.oss-cn-beijing.aliyuncs.com%2FPublic%2FImage%2Fhome%2Favatar_20191104.png; tfstk=g27KIBvcv5hLOeL0-yZiq2rTZkPgjaCeX95jrLvnVOBOaT3n-UYHVQ9OKDYoxWR-PdByKHYCETHRKOXJ4WJkFLBlNMVgorfFTU85e-40oSs3u-XKd397NVO2w5AIQv8FBU87nRmiPHzvztRM2RbC15dkZLM5FpM_6QdBP2tSRcM6QQTWPHgW5hOywXGBAT1_6QJ6FUTWrCq9UD9myi7Q3J5LUC0SPNdpXlfHCmph5BKph6_KP4GX9HpfOdy4UDh229KdSyH29G1AQBBzu28B2MsXRaeYJF1Vj9OOF-nJCiQFynbLHmJC8LWvRGesJUTeM_Kcj7ivIg1NWhQLmbRN-__emEaqdLjGMadRz8zOH66dcn_Ipg7CoZI85xvvZDNT60oyACkf3r2y9VajLCp0sBmr4hEw6KVtu0oyACR9n5Vj40-Tb; token=5ea65083947e06e9-2f9c41391bc9bc3d; access_token=5ea65083947e06e9-2f9c41391bc9bc3d; JESONG_AUTO_MON_TIMES=0; JESONG_VISITOR_ID=01000000027526385103079145651456; ssid=jlo1quiip5ct0h7crp783qd23f; ccode=0; plat=5
\ No newline at end of file
const fs = require("fs")
const path = require("path")
const cookiePath = path.resolve(__dirname, "./mockCookie.txt")
const cookie = fs.readFileSync(cookiePath, "utf8")
function setCookieOnProxyReq(proxyReq, req, res) {
proxyReq.setHeader("Cookie", cookie)
}
module.exports = {
"/homeApi": {
target: "https://fast.julyedu.com",
changeOrigin: true,
secure: false,
pathRewrite: { "^/homeApi": "" },
onProxyReq: setCookieOnProxyReq,
},
"/baseApi": {
target: "https://api.julyedu.com",
changeOrigin: true,
secure: false,
pathRewrite: { "^/baseApi": "" },
onProxyReq: setCookieOnProxyReq,
},
"/searchApi": {
target: "https://search.julyedu.com",
changeOrigin: true,
secure: false,
pathRewrite: { "^/searchApi": "" },
onProxyReq: setCookieOnProxyReq,
},
"/passportApi": {
target: "https://passport.julyedu.com",
changeOrigin: true,
secure: false,
pathRewrite: { "^/passportApi": "" },
onProxyReq: setCookieOnProxyReq,
},
"/record": {
target: "https://record.julyedu.com",
changeOrigin: true,
secure: false,
pathRewrite: { "^/record": "" },
onProxyReq: setCookieOnProxyReq,
},
"/mApi": {
target: "https://m.julyedu.com",
changeOrigin: true,
secure: false,
pathRewrite: { "^/mApi": "" },
onProxyReq: setCookieOnProxyReq,
},
"/ai-search": {
target: "https://ai-search.julyedu.com",
changeOrigin: true,
secure: false,
pathRewrite: { "^/ai-search": "" },
onProxyReq: setCookieOnProxyReq,
},
}
var API = {
'www': 'http://www-test.julyedu.com',
'home': 'http://localhost:3000/homeApi',
'search-api': 'http://localhost:3000/searchApi',
'passport-api': 'http://localhost:3000/passportApi',
'base-api': 'http://localhost:3000/baseApi',
'record': 'http://localhost:3000/record',
'home': 'http://localhost:7777/homeApi',
'search-api': 'http://localhost:7777/searchApi',
'passport-api': 'http://localhost:7777/passportApi',
'base-api': 'http://localhost:7777/baseApi',
'record': 'http://localhost:7777/record',
'process-api': 'ws:process-test.julyedu.com:9502',
'm': 'http://localhost:3000/mApi',
'ai-search': 'http://localhost:3000/ai-search',
'm': 'http://localhost:7777/mApi',
'ai-search': 'http://localhost:7777/ai-search',
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment