From b25bc8bca838d02b3e9d90d9530533e41b32fbe5 Mon Sep 17 00:00:00 2001 From: Julien Nahum Date: Tue, 16 Jan 2024 11:33:38 +0100 Subject: [PATCH] Global custom domainmiddleware client as well --- client/middleware/custom-domain.global.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/client/middleware/custom-domain.global.js b/client/middleware/custom-domain.global.js index d2b43ff..24d2381 100644 --- a/client/middleware/custom-domain.global.js +++ b/client/middleware/custom-domain.global.js @@ -17,18 +17,14 @@ function redirectToMainDomain() { } export default defineNuxtRouteMiddleware((to, from) => { - if (process.client) return + if (!customDomainUsed()) return const config = useRuntimeConfig() - if (!customDomainUsed()) return - - console.info('loadedConfig',useRuntimeConfig()) - console.log(useRequestHeaders(),customDomainHeaderName) 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',{ + console.error('Custom domain header does not match, redirecting',{ 'customDomainHeaderValue': customDomainHeaderValue, 'host': getDomain(getHost()), })