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