fix(cookieAuth): set cookie against request host instead of origin

Signed-off-by: Phil Kuang <pkuang@factset.com>
This commit is contained in:
Phil Kuang
2024-04-10 16:06:23 -04:00
parent 2c50516d51
commit 2706c3b181
@@ -225,14 +225,12 @@ class DefaultHttpAuthService implements HttpAuthService {
priority: 'high';
sameSite: 'none' | 'lax';
}> {
const originHeader = req.headers.origin;
const origin =
!originHeader || originHeader === 'null' ? undefined : originHeader;
const requestBaseUrl = `${req.protocol}://${req.hostname}`;
const externalBaseUrlStr = await this.#discovery.getExternalBaseUrl(
this.#pluginId,
);
const externalBaseUrl = new URL(externalBaseUrlStr ?? origin);
const externalBaseUrl = new URL(requestBaseUrl ?? externalBaseUrlStr);
const secure =
externalBaseUrl.protocol === 'https:' ||