fix: use relative baseURL so API calls go through vite proxy
When deployed behind a reverse proxy (e.g. opinion.moreminimore.com), hardcoding http://localhost:5001 causes the browser to try connecting to the user's own machine. Empty baseURL + vite proxy fixes this.
This commit is contained in:
@@ -3,7 +3,7 @@ import i18n from '../i18n'
|
|||||||
|
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:5001',
|
baseURL: import.meta.env.VITE_API_BASE_URL || '',
|
||||||
timeout: 300000, // 5分钟超时(本体生成可能需要较长时间)
|
timeout: 300000, // 5分钟超时(本体生成可能需要较长时间)
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
|
|||||||
Reference in New Issue
Block a user