|
|
@ -169,11 +169,20 @@ export class Routing extends Unit {
|
|
|
|
|
|
|
|
|
|
|
|
public getAppUrl(): UniversalPath {
|
|
|
|
public getAppUrl(): UniversalPath {
|
|
|
|
if ( this.request.has() ) {
|
|
|
|
if ( this.request.has() ) {
|
|
|
|
|
|
|
|
// If we have a request context, use that URL, as it is the most reliable
|
|
|
|
const request = this.request.get()
|
|
|
|
const request = this.request.get()
|
|
|
|
this.logging.debug(`url: ${request.url} | fullUrl: ${request.fullUrl}`)
|
|
|
|
const url = new URL(request.fullUrl)
|
|
|
|
|
|
|
|
return universalPath(url.origin)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const rawHost = String(this.config.get('server.url', 'http://localhost')).toLowerCase()
|
|
|
|
const urlOverride = String(this.config.get('server.url', '')).toLowerCase()
|
|
|
|
|
|
|
|
if ( urlOverride ) {
|
|
|
|
|
|
|
|
// If the config has a URL override explicitly set, use that
|
|
|
|
|
|
|
|
return universalPath(urlOverride)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Otherwise, try to build one from the host and port
|
|
|
|
|
|
|
|
const rawHost = String(this.config.get('server.host', 'http://localhost')).toLowerCase()
|
|
|
|
const isSSL = rawHost.startsWith('https://')
|
|
|
|
const isSSL = rawHost.startsWith('https://')
|
|
|
|
const port = this.config.get('server.port', 8000)
|
|
|
|
const port = this.config.get('server.port', 8000)
|
|
|
|
|
|
|
|
|
|
|
|