Skip to content

Commit

Permalink
temp disable cors
Browse files Browse the repository at this point in the history
  • Loading branch information
BEW111 committed Aug 18, 2024
1 parent 1267fbd commit a621a14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion infrastructure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ resource "aws_ecs_task_definition" "app" {
}
],
environment = [
{ "name" : "BACKEND_URL", "value" : "http://${aws_lb.app.dns_name}/api" },
{ "name" : "REACT_APP_BACKEND_URL", "value" : "http://${aws_lb.app.dns_name}/api" },
{ "name" : "TEST_ENV", "value" : "12345" },
],
// TODO: add env vars
Expand All @@ -81,6 +81,10 @@ resource "aws_ecs_task_definition" "app" {
}
],
environment = [
// TODO: we may end up needing to have two env vars here, one for the
// alb url (for cors), and one for the redirect (the actual domain name)
// - Right now we're just using `FRONTEND_URL` in the same places in
// the backend
{ "name" : "FRONTEND_URL", "value" : "http://${aws_lb.app.dns_name}/" },
{ "name" : "ATLAS_URI", "value" : var.atlas_uri },
{ "name" : "COOKIE_SECRET", "value" : var.cookie_secret },
Expand Down
8 changes: 7 additions & 1 deletion server/src/config/createExpressApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ const createExpressApp = (sessionStore: MongoStore): express.Express => {
}),
);
// Gives express the ability accept origins outside its own to accept requests from
app.use(cors({ credentials: true, origin: FRONTEND_URL }));
// app.use(cors({ credentials: true, origin: FRONTEND_URL }));
app.use(
cors({
origin: '*',
credentials: false,
}),
);
// Gives express the ability to parse client cookies and add them to req.cookies
app.use(cookieParser(process.env.COOKIE_SECRET));

Expand Down

0 comments on commit a621a14

Please sign in to comment.