© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•13mo ago•
1 reply
_andypeacock

Test tenancy redirects

Got a wierd one here.

If I go to my filament app, login, then in the browser just enter https://domain.com/admin (the default panel is 'admin'), I get successfully redirected to <default tenant>.domain.com/admin

All good.

But I try to test this via pest:

(Note: config('app.home_url_tld') is simply 'domain.com')

the final URL is https://domain.com , even though that's the same user with the default tenant

it('redirects to homepage if no tenant subdomain is defined and user has a default tenant', function () {

    $user     = User::find(1);
    $response = $this->actingAs($user)
        ->followingRedirects()
        ->get('https://'.config('app.home_url_tld')."/admin");

    $response->assertSessionHasNoErrors()
        ->assertStatus(200)
        ->assertLocation("https://".$user->getDefaultTenant()->slug.".".config('app.home_url_tld')."/admin");


})->only();
it('redirects to homepage if no tenant subdomain is defined and user has a default tenant', function () {

    $user     = User::find(1);
    $response = $this->actingAs($user)
        ->followingRedirects()
        ->get('https://'.config('app.home_url_tld')."/admin");

    $response->assertSessionHasNoErrors()
        ->assertStatus(200)
        ->assertLocation("https://".$user->getDefaultTenant()->slug.".".config('app.home_url_tld')."/admin");


})->only();


I've tested this by taking out the config helpers and just hard-coding the domain, and get the same issue.

Anyone got any idea why pest should be different to the browser in this case?
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

Issue with Tenancy-enabled test
FilamentFFilament / ❓┊help
3y ago
How to test with multi-tenancy ?
FilamentFFilament / ❓┊help
3y ago
Redirects
FilamentFFilament / ❓┊help
3y ago
Tenancy - but not tenancy?
FilamentFFilament / ❓┊help
3y ago