This commit is contained in:
陆柯 2023-01-16 15:25:02 +08:00
parent 3e186ad46a
commit be2e61b516

View File

@ -151,8 +151,8 @@ export default {
return route return route
} }
const hostname = envar.servHostname || globalThis.window?.location?.hostname || 'localhost' const hostname = envar.servHostname || 'localhost'
const port = envar.servPort || globalThis.window?.location?.port || '' const port = envar.servPort || ''
const protocol = hostname === 'localhost' ? 'http' : envar.servProtocol || (process.env.NODE_ENV === 'production' ? 'https' : 'http') const protocol = hostname === 'localhost' ? 'http' : envar.servProtocol || (process.env.NODE_ENV === 'production' ? 'https' : 'http')
return `${protocol}://${hostname}${port ? ':' : ''}${port}/${route.replace(/^\//, '')}` return `${protocol}://${hostname}${port ? ':' : ''}${port}/${route.replace(/^\//, '')}`