nelmio_cors:
    defaults:
        origin_regex: true
        allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
        allow_headers: ['Content-Type', 'Authorization', 'Accept', 'X-Requested-With']
        allow_methods: ['GET', 'POST', 'OPTIONS']
        expose_headers: []
        max_age: 86400  # Cache plus long en production (24h)
        hosts: []
        allow_credentials: false  # Sécurité renforcée
        forced_allow_origin_value: ~
        
    paths:
        # Configuration spécifique pour les APIs
        '^/api/search':
            origin_regex: true
            allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
            allow_headers: ['Content-Type', 'Accept', 'Authorization']
            allow_methods: ['GET', 'POST', 'OPTIONS']
            max_age: 86400
            allow_credentials: false
            
        '^/api/':
            origin_regex: true
            allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
            allow_headers: ['Content-Type', 'Accept']
            allow_methods: ['GET', 'OPTIONS']
            max_age: 86400
            allow_credentials: false