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

Additions to the protocol docs #303

Open
csymlstd opened this issue Jul 8, 2023 · 0 comments
Open

Additions to the protocol docs #303

csymlstd opened this issue Jul 8, 2023 · 0 comments

Comments

@csymlstd
Copy link

csymlstd commented Jul 8, 2023

While working on a JS adapter, I found a few pieces missing from the protocol docs that might help others.

Error bags will send the value through the X-Inertia-Error-Bag header, which the adapter uses to namespace the messages on the shared errors prop.

I have run into some caching issues in production as the Accept request header uses text/html. The Laravel adapter modifies the Vary header for every request to include X-Inertia. While not necessarily a requirement for the adapter to work, it is default behavior that can fix caching in most scenarios* in all adapters. The Inertia responses section should maybe display a different response:

HTTP/1.1 200 OK
Content-Type: application/json
Vary: X-Inertia, Accept
X-Inertia: true

*this unfortunately does not work with Cloudflare caching, as they do not use the Vary header in the cache key unless you are on an enterprise plan that can customize keys.

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

No branches or pull requests

1 participant