Skip to content

Commit

Permalink
Override origin in proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
cskrov committed Nov 11, 2024
1 parent 979877a commit 23dd411
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const DEV_DOMAIN = 'klage.intern.dev.nav.no';
export const DEV_URL = `https://${DEV_DOMAIN}`;

const PROD_DOMAIN = 'klage.intern.nav.no';
const PROD_URL = `https://${PROD_DOMAIN}`;
export const PROD_URL = `https://${PROD_DOMAIN}`;

export const URL: string = getEnvironmentVersion(LOCAL_URL, DEV_URL, PROD_URL);

Expand Down
3 changes: 2 additions & 1 deletion server/src/helpers/prepare-request-headers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PROXY_VERSION } from '@app/config/config';
import { DEV_DOMAIN, isDeployed } from '@app/config/env';
import { DEV_DOMAIN, DEV_URL, PROD_URL, isDeployed, isDeployedToProd } from '@app/config/env';
import { AUTHORIZATION_HEADER, CLIENT_VERSION_HEADER, PROXY_VERSION_HEADER, TOKEN_X_TOKEN_HEADER } from '@app/headers';
import { getLogger } from '@app/logger';

Expand All @@ -15,6 +15,7 @@ export const getProxyRequestHeaders = (

const headers: Record<string, string> = {
...omit(req.raw.headers, 'set-cookie'),
origin: isDeployedToProd ? PROD_URL : DEV_URL,
host: isDeployed ? appName : DEV_DOMAIN,
traceparent,
[PROXY_VERSION_HEADER]: PROXY_VERSION,
Expand Down

0 comments on commit 23dd411

Please sign in to comment.