[wp-trac] [WordPress Trac] #52636: Add proper Cache-Control header to /wp-json REST endpoints
WordPress Trac
noreply at wordpress.org
Wed Feb 24 16:09:12 UTC 2021
#52636: Add proper Cache-Control header to /wp-json REST endpoints
-------------------------+------------------------------
Reporter: isaumya | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version:
Severity: major | Resolution:
Keywords: needs-patch | Focuses: rest-api
-------------------------+------------------------------
Comment (by TimothyBlynJacobs):
WordPress doesn't send no-cache headers for the sitemap. The REST API also
shouldn't for the same reasons WordPress doesn't send no-cache headers for
other public pages as well.
That plugin appears to be using a `GET` request for something that has
side effects. They should be using a `POST` request. If they want to keep
using a `GET` request they can easily send no-cache headers themselves by
adding it to the `WP_REST_Response` object they return from their
endpoint.
If you want to send no-cache headers globally you can use the existing
`rest_send_nocache_headers` filter.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52636#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list