Skip to content

Commit

Permalink
Merge pull request #448 from decentraland/feat/add-cors-origins
Browse files Browse the repository at this point in the history
feat: Add CORS origin
  • Loading branch information
LautaroPetaccio authored Apr 17, 2024
2 parents 7853c9d + 82111fb commit 0db02c7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ app.set("x-powered-by", false)
app.use(withLogs())
app.use("/api", [
withDDosProtection(),
withCors(),
withCors({
corsOrigin: [
/^http:\/\/localhost:[0-9]{1,10}$/,
/^https:\/\/(.{1,50}\.)?decentraland\.(zone|today|org)$/,
],
allowedHeaders: "*",
}),
withBody(),
categoryRoute,
userFavoriteRoute,
Expand All @@ -75,8 +81,10 @@ app.use(metrics([gatsbyRegister, register]))
app.use("/places", socialRoutes)
app.use("/places", [
withCors({
cors: "*",
corsOrigin: "*",
corsOrigin: [
/^http:\/\/localhost:[0-9]{1,10}$/,
/^https:\/\/(.{1,50}\.)?decentraland\.(zone|today|org)$/,
],
allowedHeaders: "*",
}),
gatsby(resolve(__filename, "../../public"), {
Expand Down

0 comments on commit 0db02c7

Please sign in to comment.