Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcing Vue to use the X-Requested-With header, set to XMLHttpRequest #642

Merged
merged 1 commit into from
Aug 5, 2019
Merged

Forcing Vue to use the X-Requested-With header, set to XMLHttpRequest #642

merged 1 commit into from
Aug 5, 2019

Conversation

SDekkers
Copy link
Contributor

@SDekkers SDekkers commented Aug 5, 2019

-- resubmitting without compiled assets.

This PR is a fix for issue Issue 639

This adds an additional header to every request to the horizon API routes.
By setting the header X-Requested-With to XMLHttpRequest, Laravel knows the request is an ajax-request, so it does not update previous URL in the user session, which was undesired behavior.

Without this PR, users having Horizon open in one tab, and other parts of their project in another, might have their previous URL in their session updated to for example: /horizon/api/workload, so any part of their project using URL::previous() might return the user to an API resource, in stead of the previous URL the user visited manually

@driesvints
Copy link
Member

@SDekkers I think it's best that you explain in detail in your first comment what this actually fixes. Prs without thorough explanation tend to get closed (see the pr template).

@SDekkers
Copy link
Contributor Author

SDekkers commented Aug 5, 2019

@driesvints done

@taylorotwell taylorotwell merged commit 7cc4abc into laravel:3.0 Aug 5, 2019
@SDekkers SDekkers deleted the request_xmlhttprequest branch August 6, 2019 08:20
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.

3 participants