© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•5mo ago•
13 replies
BB

Overwrite asset_url from tenant middleware?

Is it possible to overwrite the config urls, so I can avoid cors errors?

So far I tried this, but I assume tenantMiddleware is called too late or something else?

public function handle(Request $request, Closure $next): Response
    {
        /* @var \App\Models\Bakery $tenant */
        $tenant = Filament::getTenant();

        config()->set('app.url', 'https://'.$tenant->domain);
        config()->set('app.asset_url', 'https://'.$tenant->domain);
        config()->set('filesystems.disks.public.url', 'https://'.$tenant->domain.'/storage');

        return $next($request);
    }
public function handle(Request $request, Closure $next): Response
    {
        /* @var \App\Models\Bakery $tenant */
        $tenant = Filament::getTenant();

        config()->set('app.url', 'https://'.$tenant->domain);
        config()->set('app.asset_url', 'https://'.$tenant->domain);
        config()->set('filesystems.disks.public.url', 'https://'.$tenant->domain.'/storage');

        return $next($request);
    }
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Customize Tenant URL
FilamentFFilament / ❓┊help
2y ago
Custom tenant URL
FilamentFFilament / ❓┊help
2y ago
Overwrite views from package
FilamentFFilament / ❓┊help
2y ago
Tenant middleware doesn't apply on widgets
FilamentFFilament / ❓┊help
8mo ago