fix(cookieAuth): prefer issuing cookies against target host instead of origin

Signed-off-by: Phil Kuang <pkuang@factset.com>
This commit is contained in:
Phil Kuang
2024-04-09 17:48:36 -04:00
parent 96b23786f6
commit 2c50516d51
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-app-api': patch
---
Fix auth cookie issuance for split backend deployments by preferring to set it against the request target host instead of origin
@@ -232,7 +232,7 @@ class DefaultHttpAuthService implements HttpAuthService {
const externalBaseUrlStr = await this.#discovery.getExternalBaseUrl(
this.#pluginId,
);
const externalBaseUrl = new URL(origin ?? externalBaseUrlStr);
const externalBaseUrl = new URL(externalBaseUrlStr ?? origin);
const secure =
externalBaseUrl.protocol === 'https:' ||