CORS ERROR: got cors error in one app two domains!

Error! not only widgets but all resources
Access to script at 'https://example.shop/js/filament/widgets/components/chart.js?v=3.3.32.0' from origin 'https://example.admin' has been blocked by CORS policy:

No 'Access-Control-Allow-Origin' header is present on the requested resource.

GET https://example.shop/js/filament/widgets/components/chart.js?v=3.3.32.0 net::ERR_FAILED 200 (OK)

Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: https://example.shop/js/filament/widgets/components/chart.js?v=3.3.32.0
Access to script at 'https://example.shop/js/filament/widgets/components/chart.js?v=3.3.32.0' from origin 'https://example.admin' has been blocked by CORS policy:

No 'Access-Control-Allow-Origin' header is present on the requested resource.

GET https://example.shop/js/filament/widgets/components/chart.js?v=3.3.32.0 net::ERR_FAILED 200 (OK)

Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: https://example.shop/js/filament/widgets/components/chart.js?v=3.3.32.0
AdminPanelProvoider.php
return $panel
->domain(config('app.filament'))
return $panel
->domain(config('app.filament'))
.env
APP_URL=https://example.shop
ASSERT_URL=https://example.shop
APP_FILAMENT_DOMAIN=https://example.admin
APP_URL=https://example.shop
ASSERT_URL=https://example.shop
APP_FILAMENT_DOMAIN=https://example.admin
Already tried https://laracasts.com/discuss/channels/laravel/error-cors-policy-no-access-control-allow-origin-with-laravel-11
Solution:
Thank you so much for you reply. I followed lary's comment that's working https://laracasts.com/discuss/channels/filament/cors-error-got-cors-error-in-one-app-two-domains...
Jump to solution
2 Replies
Julien B. (aka yebor974)
Hi. You have to declare some headers on your virtual host or configure your laravel cors middleware to allow these two domains. Depends of your web architecture Do you have a reverse proxy ? What is your system config ?
Solution
Shaung Bhone
Shaung Bhone3mo ago
Thank you so much for you reply. I followed lary's comment that's working https://laracasts.com/discuss/channels/filament/cors-error-got-cors-error-in-one-app-two-domains

Did you find this page helpful?