[wp-trac] [WordPress Trac] #50422: Prevent Browser Caching From Getting Involved With wp_redirect and wp_safe_redirect (Leaving the Browser to Purely Honor the Redirect Code Used)
WordPress Trac
noreply at wordpress.org
Wed Mar 19 15:03:35 UTC 2025
#50422: Prevent Browser Caching From Getting Involved With wp_redirect and
wp_safe_redirect (Leaving the Browser to Purely Honor the Redirect Code
Used)
-------------------------------------+------------------------------
Reporter: KZeni | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.4.2
Severity: normal | Resolution:
Keywords: needs-testing has-patch | Focuses:
-------------------------------------+------------------------------
Comment (by tha_sun):
–1
Adding `nocache_headers()` to every redirect is not correct and should not
be accepted.
The situation you are describing only applies to the special case of
switching between anonymous and authenticated user sessions.
For most other redirects, it is actually advisable to let layers in front
of the site cache the redirect response, so that the same response does
not have to be regenerated all over again.
The current proposal won't fix in my opinion, because it would enforce a
behavior that does not make sense for the vast majority of redirect use
cases.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50422#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list