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

Add X-Requested-With: XMLHttpRequest to all requests #17

Merged
merged 5 commits into from
Jun 5, 2024

Conversation

micahhahn
Copy link
Member

@micahhahn micahhahn commented Jun 5, 2024

We have annoying issues crop up periodically with DELETE requests (silently) requiring a CSRF token when other request types don't.

This stems from the following code, which shows its actually the body content-type being JSON that matters - and DELETES just happen to not typically have bodies.

https://github.com/NoRedInk/NoRedInk/blob/387f54e9db092e4188116bd8d2daa06460dd8bcc/monolith/app/controllers/application_controller.rb#L117

So instead this PR adds the X-Requested-With: XMLHttpRequest header to all requests.

@micahhahn micahhahn requested a review from omnibs June 5, 2024 17:04
micahhahn added 2 commits June 5, 2024 13:25
It's a constant source of confusion as the instance is present for CI (presumably because its build with slack, but locally with cabal the instance is missing?).  Perhaps a different version of something is being pulled in.
Copy link
Member

@omnibs omnibs left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you for fixing this forever for everyone

@omnibs omnibs merged commit c85fdc2 into master Jun 5, 2024
2 checks passed
@omnibs omnibs deleted the add-x-requested-with-to-all-requests branch June 5, 2024 18:47
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.

2 participants