bundle在bundle.php中被删除了
return [
...
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
...
];
这是我对NelmioCorsBundle的设置
nelmio_cors:
defaults:
origin_regex: true
allow_origin: ['*']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
expose_headers: ['Link']
max_age: 3600
paths:
'^/': ~
我已经阅读了CORS的文档。
我不希望黑客能够使其在Chrome或Firefox上运行。
我已尝试在响应中手动注入'Access-Control-Allow-Origin:*'
nelmio_cors:
defaults:
origin_regex: true
allow_origin: ['*']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
expose_headers: ['Link']
forced_allow_origin_value: ['*']
max_age: 3600
paths:
'^/': ~