fix(api): 🐛 prevent webauthn relying party protocol mismatch when server is behind a proxy
This commit is contained in:
parent
ad34e6a3e4
commit
a18142277f
|
@ -1,6 +1,11 @@
|
||||||
export function getRelyingParty(url: string | URL) {
|
export function getRelyingParty(url: string | URL) {
|
||||||
url = new URL(url)
|
url = new URL(url)
|
||||||
|
|
||||||
|
// Prevent protocol mismatch when server is behind a proxy
|
||||||
|
if (!['localhost', '127.0.0.1', '0.0.0.0'].includes(url.hostname)) {
|
||||||
|
url.protocol = 'https'
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Human-readable title for your website
|
* Human-readable title for your website
|
||||||
|
|
Loading…
Reference in a new issue