From c35c5051141e84674bef1218c5be08a84aa64ef3 Mon Sep 17 00:00:00 2001 From: Julien Nahum Date: Mon, 15 Jan 2024 16:49:24 +0100 Subject: [PATCH] Debugging custom domain --- client/lib/utils.js | 5 +++++ client/middleware/custom-domain.global.js | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/client/lib/utils.js b/client/lib/utils.js index 7d3df6f..e77e3ad 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -77,5 +77,10 @@ export const customDomainUsed = function() { const appDomain = getDomain(config.public.appUrl) const host = getHost() + console.debug('customDomainUsed', { + 'appDomain': appDomain, + 'host': host, + 'customDomain': host !== appDomain && getDomain(host) !== appDomain + }) return host !== appDomain && getDomain(host) !== appDomain } diff --git a/client/middleware/custom-domain.global.js b/client/middleware/custom-domain.global.js index d5711e9..df17179 100644 --- a/client/middleware/custom-domain.global.js +++ b/client/middleware/custom-domain.global.js @@ -26,6 +26,10 @@ export default defineNuxtRouteMiddleware((to, from) => { const customDomainHeaderValue = useRequestHeaders()[customDomainHeaderName] if (!customDomainHeaderValue || customDomainHeaderValue !== getDomain(getHost())) { // If custom domain header doesn't match, redirect + console.info('Custom domain header does not match, redirecting',{ + 'customDomainHeaderValue': customDomainHeaderValue, + 'host': getDomain(getHost()), + }) return redirectToMainDomain() }