Skip to content

Commit e2eaada

Browse files
fix: Make CORS config support www as well
1 parent 40961ec commit e2eaada

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/payload.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ export default buildConfig({
3535
routes: {
3636
admin: '/',
3737
},
38-
cors: [process.env.FRONTEND_URL || ''],
38+
cors: [
39+
process.env.FRONTEND_URL || '',
40+
process.env.FRONTEND_URL?.startsWith('https')
41+
? `https://www.${new URL(process.env.FRONTEND_URL).hostname}`
42+
: '',
43+
].filter(Boolean),
3944
collections: [Users, Media, Events, Sponsors, Tech_Stack, Projects], // Include any new collections here
4045
editor: lexicalEditor(),
4146
secret: process.env.PAYLOAD_SECRET || '',

0 commit comments

Comments
 (0)