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

Cachify does not support Content Negotiation #265

Closed
pfefferle opened this issue Apr 26, 2022 · 1 comment · Fixed by #273
Closed

Cachify does not support Content Negotiation #265

pfefferle opened this issue Apr 26, 2022 · 1 comment · Fixed by #273
Milestone

Comments

@pfefferle
Copy link
Member

Describe the bug
If a page has different views based on the Accept header, Cachify caches the output of the first request. If the request is application/json for example, Cachify always returns the JSON output on every following request.

To Reproduce
Steps to reproduce the behavior:

  1. Install the ActivityPub plugin
  2. Load the author page with Accept header application/activity+json
  3. Load the author page again in the browser
  4. See the JSON output

Expected behavior
Only cache requests with html Accept headers (https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation/List_of_default_Accept_values) and return the dynamic/uncached content otherwise.

@florianbrinkmann
Copy link
Member

Maybe we can add a check in the .htaccess like that:

<If "(%{HTTP_ACCEPT} -strmatch '*text/html*')">
    Rewrite 
</If>

Tried to test that quickly but had a setup issue with cachify :D Wanted to post that here so I do not forget that.

@stklcode stklcode linked a pull request Jan 17, 2023 that will close this issue
stklcode pushed a commit that referenced this issue Jan 17, 2023
Add conditions for the HTTP "Accept" header to both cache generation and
webserver configuration so that only HTML content is served from cache.
@stklcode stklcode added this to the 2.4.0 milestone Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants