Skip to content

Embed route must be skipped, otherwise it will not work with sessions#50

Open
MasterZydra wants to merge 2 commits intowire-elements:2.xfrom
MasterZydra:fix-embed-for-session
Open

Embed route must be skipped, otherwise it will not work with sessions#50
MasterZydra wants to merge 2 commits intowire-elements:2.xfrom
MasterZydra:fix-embed-for-session

Conversation

@MasterZydra
Copy link
Contributor

@MasterZydra MasterZydra commented Feb 16, 2026

This PR resolves an issue where loading the embed route fails when using wire-extender with sessions enabled.
To address this, a condition has been added to bypass the CSRF check for the embed route.

@PhiloNL this could be a fix for the 419 status codes on the embed route like in #33 and #39

Co-authored-by: Laurin Stapf <72888948+LaurinStapf@users.noreply.github.com>
Co-authored-by: J. Glück <65236355+JGlueck-WIKA@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a 419 CSRF error that occurs when accessing the wire-extender embed route with sessions enabled. The fix adds a CSRF bypass for the /livewire/embed route by checking the request URI before applying CSRF validation.

Changes:

  • Added getEmbedUri() method to return the embed route path
  • Added CSRF bypass condition for the embed route in the IgnoreForWireExtender middleware
  • Named the embed route as 'wire-extender.embed' for route matching capabilities

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/WireExtender.php Added getEmbedUri() method to retrieve the embed route path using Laravel's route helper
src/Http/Middlewares/IgnoreForWireExtender.php Added early return to bypass CSRF check when request is to the embed route; reordered comparison operands in isLivewireUpdateRequest() for consistency
routes/api.php Added route name 'wire-extender.embed' to the embed route; removed unused import

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Laurin Stapf <72888948+LaurinStapf@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant