diegslapasteque
Using domain causes CORS issues
Hello everyone 👋
I faced the same issue, and I found a solution to serve assets using the new domain if you're interested in :
1 - Create a new FILAMENT_ASSET_URL=https://admin.example.com in your
.env
.
2 - Add a new configuration value in config/filament.php :
3 - Add this code at the beginning of AdminPanelProvider
to replace the asset url at runtime :
It's not mandatory to create a dedicated environment variable like I did, but I prefer to do it to keep the same behavior than laravel that also have a dedicated ASSET_URL
variable. Moreover, if the assets are stored on a CDN or something like that, it will be easy to change the FILAMENT_ASSET_URL too.
Maybe I should create a PR to propose to add a new ->assetUrl() method in the Filament\Panel, or to directly change the app.asset_url
when a ->domain()
is called...
Hope it will helps 46 replies