本地开发环境使用代理模式
This commit is contained in:
parent
be55a17384
commit
bd678d53d9
|
|
@ -202,6 +202,7 @@
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "react-app"
|
"extends": "react-app"
|
||||||
},
|
},
|
||||||
|
"proxy": "https://testforgeplus.trustie.net",
|
||||||
"port": "3007",
|
"port": "3007",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.23.6",
|
"@babel/core": "^7.23.6",
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) {
|
||||||
// 判断网络是否连接
|
// 判断网络是否连接
|
||||||
initOnlineOfflineListener();
|
initOnlineOfflineListener();
|
||||||
|
|
||||||
var proxy = "https://testforgeplus.trustie.net";
|
// var proxy = "https://testforgeplus.trustie.net";
|
||||||
// var proxy = "http://172.20.32.201:4000";
|
// var proxy = "http://172.20.32.201:4000";
|
||||||
// var proxy = "https://www.gitlink.org.cn";
|
// var proxy = "https://www.gitlink.org.cn";
|
||||||
|
|
||||||
|
|
@ -45,18 +45,18 @@ export function initAxiosInterceptors(props) {
|
||||||
requestProxy(config);
|
requestProxy(config);
|
||||||
let url = `/api${config.url}`;
|
let url = `/api${config.url}`;
|
||||||
|
|
||||||
if (window.location.port === "3007") {
|
// if (window.location.port === "3007") {
|
||||||
config.url = `${proxy}${url}`;
|
// config.url = `${proxy}${url}`;
|
||||||
if (config.url.indexOf('?') === -1) {
|
// if (config.url.indexOf('?') === -1) {
|
||||||
config.url = `${config.url}`;
|
// config.url = `${config.url}`;
|
||||||
} else {
|
// } else {
|
||||||
config.url = `${config.url}`;
|
// config.url = `${config.url}`;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
config.url = url;
|
// config.url = url;
|
||||||
}
|
// }
|
||||||
config.withCredentials = false;
|
config.withCredentials = false;
|
||||||
// config.url = url;
|
config.url = url;
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue