GoogleCloudPlatform / GoogleCloudPlatform/esp-v2
Enable different CORS handling for different endpoints
- Dominant language
- Go
- Stars
- 307
- Forks
- 185
- Avg merge
- 14h 45m
- Merged PRs (30d)
- 6
Description
We are using ESPv2 to manage endpoints for our backend API, including dozens of endpoints provided by different services in our cluster. We currently have CORS set to accept only a small number of domains (using `--cors_preset=cors_with_regex`). However, some of our endpoints represent a "public" API, meant for external use, and we'd like to provide the `Access-Control-Allow-Origin: *` header for those endpoints.
Is there any way to configure ESPv2 for this scenario? As far as I can tell, our choices are to turn off CORS handling in ESPv2, requiring us to add CORS support to every underlying BE service, or to move all endpoints to the more permissive setting, neither of which is an attractive option.
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by tracing how --cors_preset=cors_with_regex is applied across endpoints and whether endpoint-specific CORS configuration is supported; done would be a documented, validated way to allow wildcard origins only for selected public endpoints.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100