Skip to content

Commit

Permalink
Merge pull request #19 from decentraland/fix/cors
Browse files Browse the repository at this point in the history
feat: fix CORS issue
  • Loading branch information
juanmahidalgo authored Nov 26, 2024
2 parents d0b96cc + 938f37a commit dbaa87e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ export async function initComponents(): Promise<AppComponents> {
const config = await createDotEnvConfigComponent({
path: ['.env.default', '.env']
})
const corsString = await config.requireString('CORS_METHODS')
const validCORSJsonString = corsString.replace(/'/g, '"')

const cors = {
origin: (await config.requireString('CORS_ORIGIN')).split(';').map(origin => new RegExp(origin)),
methods: await config.requireString('CORS_METHODS'),
methods: JSON.parse(validCORSJsonString),
credentials: true
}

Expand Down

0 comments on commit dbaa87e

Please sign in to comment.