fix(api): 🐛 prevent webauthn relying party protocol mismatch when server is behind a proxy

This commit is contained in:
Julien Oculi 2024-06-22 16:07:47 +02:00
parent ad34e6a3e4
commit a18142277f

View file

@ -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