Fix CORS config: remove duplicate, move localhost to dev only#964
Fix CORS config: remove duplicate, move localhost to dev only#964
Conversation
- Remove duplicate play.filters.cors.allowedHttpMethods line - Move http://localhost:5173 from base.conf to devandtest.conf so localhost origin is not allowed in production Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates Play CORS configuration to avoid allowing localhost origins in production and removes redundant config duplication.
Changes:
- Remove duplicated
play.filters.cors.allowedHttpMethodsentry frombase.conf. - Restrict production
play.filters.cors.allowedOriginsto theapp.apibuilder.io/app.apibuilder.orgorigins only. - Add
http://localhost:5173to CORS allowed origins indevandtest.conf(dev/test only).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
api/conf/base.conf |
Removes duplicate allowedHttpMethods line and removes localhost from the base (production-inherited) allowed origins list. |
api/conf/devandtest.conf |
Adds a dev/test override for allowedOrigins including http://localhost:5173. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
api/conf/devandtest.conf
Outdated
| play.filters.cors.allowedOrigins = [ | ||
| "https://app.apibuilder.io", | ||
| "https://app.apibuilder.org", | ||
| "http://localhost:5173" | ||
| ] | ||
|
|
There was a problem hiding this comment.
devandtest.conf fully redefines play.filters.cors.allowedOrigins, duplicating the two production origins from base.conf. This can drift if the base list changes (e.g., adding/removing a prod origin) and dev/test won’t automatically inherit it. Prefer appending just the localhost origin to the existing list (e.g., via HOCON list append) so dev/test stays aligned with base by default.
| play.filters.cors.allowedOrigins = [ | |
| "https://app.apibuilder.io", | |
| "https://app.apibuilder.org", | |
| "http://localhost:5173" | |
| ] | |
| play.filters.cors.allowedOrigins += [ | |
| "http://localhost:5173" | |
| ] |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
play.filters.cors.allowedHttpMethodsline inbase.confhttp://localhost:5173frombase.conftodevandtest.confso localhost origin is not allowed in productionAddresses review feedback from #963.
Test plan
apibuilder.ioandapibuilder.orgoriginslocalhost:5173viadevandtest.confoverride🤖 Generated with Claude Code