[wp-trac] [WordPress Trac] #52636: Add proper Cache-Control header to /wp-json REST endpoints

WordPress Trac noreply at wordpress.org
Thu Jan 18 16:15:46 UTC 2024


#52636: Add proper Cache-Control header to /wp-json REST endpoints
-------------------------+-----------------------
 Reporter:  isaumya      |       Owner:  (none)
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  REST API     |     Version:
 Severity:  major        |  Resolution:  wontfix
 Keywords:  needs-patch  |     Focuses:  rest-api
-------------------------+-----------------------
Changes (by TimothyBlynJacobs):

 * status:  reopened => closed
 * resolution:   => wontfix


Comment:

 WordPress Core does not differentiate between Core endpoints and non-Core
 endpoints. You can see that here:

 https://github.com/WordPress/wordpress-
 develop/blob/e707e37f23dcb6723ba3cea22d45f8f35ef95deb/src/wp-includes
 /rest-api/class-wp-rest-server.php#L483

 I was able to find the WooFunnels code, and they are #doingitwrong by
 calling `wp_send_json` in their REST API callback. This completely stops
 the REST API server from sending the request.

 https://plugins.trac.wordpress.org/browser/funnel-builder/trunk/woofunnels
 /as-data-store/class-woofunnels-as-ds.php#L280

 I wasn't able to easily find the `autonami-webhook` code, but I'm guessing
 they are making a similar error.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52636#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list