Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Laravelzero's avatar

Filament/Laravel into iframe

Hi guys, i'm using iframe to load my Laravel site using Filamentphp v2. I'm on localhost and It work well without iframe. I notice the cookies are created, but when login successfully the page is just reloaded (redirected to login). On config/session.php i tested:

    'secure' => env('SESSION_SECURE_COOKIE',false),
    'same_site' => 'Lax',

and

    'secure' => env('SESSION_SECURE_COOKIE',false),
    'same_site' => 'none',

SESSION_SECURE_COOKIE is set o false on .env

The login pass this step: vendor/jeffgreco13/filament-breezy/src/Http/Livewire/Auth/Login.php:

    protected function attemptAuth($data)
    {
        // ->attempt will actually log the person in, then the response sends them to the dashboard. We need to catch the auth, show the code prompt, then log them in.
        if (! Filament::auth()->attempt([
            $this->loginColumn => $data[$this->loginColumn],
            'password' => $data['password'],
        ], $data['remember'])) {
            $this->addError($this->loginColumn, __('filament::login.messages.failed'));

            return null;
        }
        event(new LoginSuccess(Filament::auth()->user()));

        return app(LoginResponse::class);   // success
    }

0 likes
6 replies
Tray2's avatar

Why on earth would you use an iframe for your own site like that?

jlrdw's avatar

@Tray2 there's times i use an object in a modal, but mostly for lookup tables. The good thing about it is you have full search and pagination.

See here https://laracasts.com/discuss/channels/laravel/can-i-redirect-a-get-request-to-a-post-request-for-inertia-partial-reloads

Was just example with test data. I did similar for looking up which carrier was hauling a load, shipper, receiver, etc.

I use select option when only a few possible choices.

But I agree with @tray2 here, @laravelzero in your use case why an iframe?

Tray2's avatar

@jlrdw There are a few rare cases that might warrant an iframe, but I can't really think of any right now. There are better ways to do most things now, that warranted using an iframe before.

Laravelzero's avatar

@Tray2 haha, yes, it may sound strange, but in my case I have a portfolio with a list of works (websites) that I have done, I design the main page in a way to preview these applications while staying on the same page using iframe. For simple HTML files, no problem, but I had a problem with the Laravel project on the login page (demo site that anyone can log in to).

Tray2's avatar

@Laravelzero Why not just use a simple screen shot and a link to the page instead, that is a much better solution than generating load times on you site just because you need to fetch from external sites and domains.

Please or to participate in this conversation.