• Resolved getsnoopy

    (@getsnoopy)


    In the Browser Cache settings, I see that Media & Other Files settings are set to 1 year by default. However, JSON files and responses (i.e., responses with the Content-Type: application/json header) are automatically considered to be in this category as well, which is problematic because most JSON is for API responses, which should not be cached. There’s no way to specifically target JSON files/types.

    After observing the rules W3 Total Cache is adding to the .htaccess file, it seems like it’s adding the following rules which are the culprits:

    AddType application/json .json
    ExpiresByType application/json A2419200

    There are a couple of options here that can solve this:

    1. JSON files/types should be moved from the Media & Other Files category to the HTML & XML category.
    2. (Preferred solution) JSON files/types should be moved into their own category.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @getsnoopy

    Thank you for reaching out and thank you for your suggestion.

    Can you please share if you are experiencing any issues with the API responses and is the REST API caching enabled in the Page Cache section?

    Thanks!

    Thread Starter getsnoopy

    (@getsnoopy)

    @vmarko REST API caching is disabled, and yes, we are experiencing issues. It keeps sending the Cache-Control: max-age=2419200 header to the browser, which is caching the JSON response from one of our API endpoints browser-side.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @getsnoopy

    Let me try to replicate this and see if there are any issues.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘JSON should not be considered “Media & Other”’ is closed to new replies.