Skip to content

Commit

Permalink
fix: Prepend https to team.domain
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Jan 16, 2024
1 parent b11c160 commit 8a6b2a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api.planx.uk/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ const checkAllowedOrigins: CorsOptions["origin"] = (origin, callback) => {
const isTest = process.env.NODE_ENV === "test";
const isDevelopment = process.env.APP_ENVIRONMENT === "development";
const allowList = process.env.CORS_ALLOWLIST?.split(", ") || [];
const isAllowed = origin && allowList.includes(origin);
const isAllowed = Boolean(origin && allowList.includes(origin));

isTest || isDevelopment || isAllowed
!origin || isTest || isDevelopment || isAllowed
? callback(null, true)
: callback(new Error("Not allowed by CORS"));
};
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/application/utils/generateCORSAllowList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as awsx from "@pulumi/awsx";
import { CustomDomains } from "../../common/teams";

export const generateCORSAllowList = (customDomains: CustomDomains, domain: string): awsx.ecs.KeyValuePair => {
const customDomainURLs = customDomains.map(team => team.domain);
const customDomainURLs = customDomains.map(team => `https://${team.domain}`);
const editorURL = `https://${domain}`;
const corsAllowList = [...customDomainURLs, editorURL];

Expand Down

0 comments on commit 8a6b2a2

Please sign in to comment.