fix(persona-studio): 修复「我要开发」后端连接失败 [ZY-FIX]
Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
parent
73db98300c
commit
b913d119e4
|
|
@ -12,7 +12,17 @@ const apikeyRoutes = require('./routes/apikey');
|
|||
const previewRoutes = require('./routes/preview');
|
||||
|
||||
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' }));
|
||||
|
||||
// ── 静态文件:persona-studio 前端 ──
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ const API_BASE = (function () {
|
|||
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
|
||||
return 'http://localhost:3002';
|
||||
}
|
||||
return 'https://guanghulab.com';
|
||||
// 非本地环境统一使用当前域名 + 协议,走 Nginx 转发
|
||||
return location.protocol + '//' + location.host;
|
||||
})();
|
||||
|
||||
/* ---- State ---- */
|
||||
|
|
|
|||
|
|
@ -152,7 +152,8 @@
|
|||
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
|
||||
return 'http://localhost:3002';
|
||||
}
|
||||
return 'https://guanghulab.com';
|
||||
// 非本地环境统一使用当前域名 + 协议,走 Nginx 转发
|
||||
return location.protocol + '//' + location.host;
|
||||
}
|
||||
|
||||
function normalizeApiBase(base) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue