Debugging custom domain redirect opnform
More debugging on custom domain side Debugging custom domain redirect further Debugging custom domain redirect opnform More debugging on custom domain side Debugging custom domain redirect further
This commit is contained in:
parent
08171adc56
commit
fbc0457294
|
|
@ -67,6 +67,7 @@ export function getOpnRequestsOptions(request, opts) {
|
||||||
}
|
}
|
||||||
} else if (status === 420) {
|
} else if (status === 420) {
|
||||||
// If invalid domain, redirect to main domain
|
// If invalid domain, redirect to main domain
|
||||||
|
console.warn("Invalid response from back-end - redirecting to main domain")
|
||||||
window.location.href =
|
window.location.href =
|
||||||
config.public.appUrl + "?utm_source=failed_custom_domain_redirect"
|
config.public.appUrl + "?utm_source=failed_custom_domain_redirect"
|
||||||
} else if (status >= 500) {
|
} else if (status >= 500) {
|
||||||
|
|
|
||||||
|
|
@ -107,5 +107,13 @@ export const customDomainUsed = function () {
|
||||||
const appDomain = getDomain(config.public.appUrl)
|
const appDomain = getDomain(config.public.appUrl)
|
||||||
const host = getHost()
|
const host = getHost()
|
||||||
|
|
||||||
|
console.log('Checking if custom domain is used', {
|
||||||
|
appDomain,
|
||||||
|
host,
|
||||||
|
getDomain: getDomain(host),
|
||||||
|
used: host !== appDomain,
|
||||||
|
hostDomainused: getDomain(host) !== appDomain
|
||||||
|
})
|
||||||
|
|
||||||
return host !== appDomain && getDomain(host) !== appDomain
|
return host !== appDomain && getDomain(host) !== appDomain
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,14 @@ const customDomainHeaderName = "user-custom-domain"
|
||||||
const customDomainAllowedRoutes = ["forms-slug"]
|
const customDomainAllowedRoutes = ["forms-slug"]
|
||||||
|
|
||||||
function redirectToMainDomain(details = {}) {
|
function redirectToMainDomain(details = {}) {
|
||||||
console.warn("Redirecting to main domain", { reason: "unknown", ...details })
|
const appDomain = getDomain(config.public.appUrl)
|
||||||
|
const host = getHost()
|
||||||
|
console.warn("Redirecting to main domain", {
|
||||||
|
reason: "unknown",
|
||||||
|
appDomain,
|
||||||
|
host,
|
||||||
|
getDomain: getDomain(host), ...details
|
||||||
|
})
|
||||||
return navigateTo(
|
return navigateTo(
|
||||||
useRuntimeConfig().public.appUrl +
|
useRuntimeConfig().public.appUrl +
|
||||||
"?utm_source=failed_custom_domain_redirect",
|
"?utm_source=failed_custom_domain_redirect",
|
||||||
|
|
@ -50,6 +57,7 @@ export default defineNuxtRouteMiddleware((to) => {
|
||||||
// Custom domain only allowed for form url
|
// Custom domain only allowed for form url
|
||||||
return redirectToMainDomain({
|
return redirectToMainDomain({
|
||||||
reason: "route_not_allowed",
|
reason: "route_not_allowed",
|
||||||
|
route: to.name
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue