Skip to content

[4.x] Add Vary: X-Requested-With header to CP responses #10016

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

Merged
merged 2 commits into from
May 7, 2024

Conversation

duncanmcclean
Copy link
Member

This pull request adds a Vary: X-Requested-With header to Control Panel responses.

This fixes an issue with the Users listing page on Chrome. If you go onto the users listing table, do any kind of filtering, click on a user, then use the browser back button, you'll see a JSON response instead of the listing page.

This was only happening on the Users listing because it's the Blade view & JSON responses share the same URL, where our other listing pages have separate URLs.

From what I can tell, I believe this issue is only affecting Chrome(ium). The Vary header seems to tell the browser which headers cause a different response to be returned - the X-Requested-With header is different between the two types of requests so it fixes the issue.

Fixes #9937.

@jasonvarga jasonvarga merged commit e94487b into 4.x May 7, 2024
36 checks passed
@jasonvarga jasonvarga deleted the add-vary-header-to-cp-responses branch May 7, 2024 21:24
@aerni
Copy link
Contributor

aerni commented May 8, 2024

I ran into this issue a couple of times when navigating back to the entries listing too. Just a quick note. I never bothered raising an issue and don't know when I last saw it. Might be fixed by now.

@duncanmcclean
Copy link
Member Author

I ran into this issue a couple of times when navigating back to the entries listing too. Just a quick note. I never bothered raising an issue and don't know when I last saw it. Might be fixed by now.

Oh weird, I've never ran into it with the entries listing. Hopefully this PR fixes it for you anyway. If it hasn't, feel free to open an issue and we can take a look.

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.

Clicking back button after filtering users returns raw json response
3 participants