fix: handle same-origin deployments in postMessage validation

Fall back to window.location.origin when baseUrl is empty or relative,
supporting same-origin deployments while maintaining origin validation.
This commit is contained in:
Vinay Keerthi
2026-01-12 16:34:13 +05:30
parent eee307b36b
commit 3aea425abc
+4 -2
View File
@@ -44,12 +44,14 @@ const updateAuthCookie = (cookieContent, baseDomain = '') =>
const getTargetOrigin = () => {
const { baseUrl } = window.$chatwoot || {};
if (!baseUrl) return null;
if (!baseUrl) {
return window.location.origin;
}
try {
const url = new URL(baseUrl);
return url.origin;
} catch {
return null;
return window.location.origin;
}
};