Merge pull request #107 from qinfendebingshuo/copilot/fix-persona-studio-backend-connection
fix(persona-studio): 修复「我要开发」后端连接失败
This commit is contained in:
commit
4192905dd0
|
|
@ -12,7 +12,17 @@ const apikeyRoutes = require('./routes/apikey');
|
||||||
const previewRoutes = require('./routes/preview');
|
const previewRoutes = require('./routes/preview');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(cors());
|
app.use(cors({
|
||||||
|
origin: [
|
||||||
|
'http://localhost:3002',
|
||||||
|
'http://127.0.0.1:3002',
|
||||||
|
'http://8.155.62.235',
|
||||||
|
'https://guanghulab.com',
|
||||||
|
'http://guanghulab.com',
|
||||||
|
'https://qinfendebingshuo.github.io'
|
||||||
|
],
|
||||||
|
credentials: true
|
||||||
|
}));
|
||||||
app.use(express.json({ limit: '2mb' }));
|
app.use(express.json({ limit: '2mb' }));
|
||||||
|
|
||||||
// ── 静态文件:persona-studio 前端 ──
|
// ── 静态文件:persona-studio 前端 ──
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@ const API_BASE = (function () {
|
||||||
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
|
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
|
||||||
return 'http://localhost:3002';
|
return 'http://localhost:3002';
|
||||||
}
|
}
|
||||||
return 'https://guanghulab.com';
|
// 非本地环境统一使用当前域名 + 协议,走 Nginx 转发
|
||||||
|
return location.protocol + '//' + location.host;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/* ---- State ---- */
|
/* ---- State ---- */
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,8 @@
|
||||||
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
|
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
|
||||||
return 'http://localhost:3002';
|
return 'http://localhost:3002';
|
||||||
}
|
}
|
||||||
return 'https://guanghulab.com';
|
// 非本地环境统一使用当前域名 + 协议,走 Nginx 转发
|
||||||
|
return location.protocol + '//' + location.host;
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeApiBase(base) {
|
function normalizeApiBase(base) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue