Add force SSL config flag
This commit is contained in:
parent
48ce1bfa2f
commit
afbf6e7682
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@extollo/lib",
|
"name": "@extollo/lib",
|
||||||
"version": "0.9.45",
|
"version": "0.9.46",
|
||||||
"description": "The framework library that lifts up your code.",
|
"description": "The framework library that lifts up your code.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
@ -168,10 +168,15 @@ export class Routing extends Unit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getAppUrl(): UniversalPath {
|
public getAppUrl(): UniversalPath {
|
||||||
|
const forceSsl = Boolean(this.config.get('server.forceSsl', false))
|
||||||
|
|
||||||
if ( this.request.has() ) {
|
if ( this.request.has() ) {
|
||||||
// If we have a request context, use that URL, as it is the most reliable
|
// 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()
|
||||||
const url = new URL(request.fullUrl)
|
const url = new URL(request.fullUrl)
|
||||||
|
if ( forceSsl ) {
|
||||||
|
url.protocol = 'https:'
|
||||||
|
}
|
||||||
return universalPath(url.origin)
|
return universalPath(url.origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user