Add CorsRegexEnvProcessor and corresponding tests
- Implemented CorsRegexEnvProcessor to build CORS origin regex from a comma-separated host list (ALLOWED_FRONTEND_HOSTS). - Added tests for CorsRegexEnvProcessor to validate regex generation and matching behavior. - Created JSON files for AST representation of the new classes and tests.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
nelmio_cors:
|
||||
defaults:
|
||||
origin_regex: true
|
||||
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
|
||||
allow_origin: ['%env(cors_regex:ALLOWED_FRONTEND_HOSTS)%']
|
||||
allow_methods: ['GET', 'OPTIONS', 'POST', 'PATCH', 'DELETE']
|
||||
allow_headers: ['Content-Type', 'Authorization', 'X-CSRF-Token', 'Content-Disposition']
|
||||
expose_headers: ['X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-RateLimit-Reset']
|
||||
@@ -9,8 +9,8 @@ nelmio_cors:
|
||||
allow_credentials: false
|
||||
paths:
|
||||
'^/api/':
|
||||
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
|
||||
allow_origin: ['%env(cors_regex:ALLOWED_FRONTEND_HOSTS)%']
|
||||
'^/oauth/':
|
||||
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
|
||||
allow_origin: ['%env(cors_regex:ALLOWED_FRONTEND_HOSTS)%']
|
||||
'^/health':
|
||||
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
|
||||
allow_origin: ['%env(cors_regex:ALLOWED_FRONTEND_HOSTS)%']
|
||||
|
||||
Reference in New Issue
Block a user