Fixes for CORS

This commit is contained in:
David Bomba 2021-06-02 10:48:48 +10:00
parent 24b7cb7509
commit 37de17cf38
2 changed files with 4 additions and 1 deletions

View File

@ -101,6 +101,7 @@ class Kernel extends HttpKernel
'throttle:60,1', 'throttle:60,1',
'bindings', 'bindings',
'query_logging', 'query_logging',
Cors::class,
], ],
'client' => [ 'client' => [
EncryptCookies::class, EncryptCookies::class,
@ -111,6 +112,7 @@ class Kernel extends HttpKernel
VerifyCsrfToken::class, VerifyCsrfToken::class,
SubstituteBindings::class, SubstituteBindings::class,
QueryLogging::class, QueryLogging::class,
Cors::class,
], ],
'shop' => [ 'shop' => [
'throttle:120,1', 'throttle:120,1',
@ -125,7 +127,7 @@ class Kernel extends HttpKernel
ShareErrorsFromSession::class, ShareErrorsFromSession::class,
SubstituteBindings::class, SubstituteBindings::class,
QueryLogging::class, QueryLogging::class,
VerifyCsrfToken::class, // VerifyCsrfToken::class,
], ],
]; ];

View File

@ -25,6 +25,7 @@ class Cors
$response = $next($request); $response = $next($request);
$response->headers->set('Access-Control-Allow-Origin', '*'); $response->headers->set('Access-Control-Allow-Origin', '*');
$response->headers->set('Access-Control-Allow-Credentials', 'True');
$response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); $response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
$response->headers->set('Access-Control-Allow-Headers', 'X-API-COMPANY-KEY,X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-CSRF-TOKEN,X-LIVEWIRE'); $response->headers->set('Access-Control-Allow-Headers', 'X-API-COMPANY-KEY,X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,X-CSRF-TOKEN,X-LIVEWIRE');
$response->headers->set('Access-Control-Expose-Headers', 'X-APP-VERSION,X-MINIMUM-CLIENT-VERSION'); $response->headers->set('Access-Control-Expose-Headers', 'X-APP-VERSION,X-MINIMUM-CLIENT-VERSION');