Bug #88178
closedPage cache is deleted, when an uncached (Extbase) Plugin performs a redirect
100%
Description
There is a legitimate case that a plugin performs a redirect (sends Location header).
Usually such plugins are defined as uncached.
Uncached plugins are called, even when the rest of the page remains cached.
With the change applied for #83755 any redirect performed by such plugins, leads to the complete page cache being deleted.
On a side note (and the reason I ran into this), rendering frontend pages on CLI with the goal to warm up the cache is not possible any more after this change,
because http_response_code() always returns false when called from cli SAPI.
Updated by Helmut Hummel over 5 years ago
My conclusion would be: Any plugin that needs a redirect, should be marked as not cachable.
If there is a valid case for giving cached plugins the possiblity to perform a permanent redirect,
then this redirect should be stored in the cache and be handled right after the cache is retrieved.
Updated by Gerrit Code Review over 5 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60518
Updated by Helmut Hummel over 5 years ago
- Related to Bug #83755: Extbase TYPO3\CMS\Extbase\Mvc\Controller\AbstractController->redirectToUri() – remove HTML redirect? added
Updated by Markus Klein over 5 years ago
A usecase, which contradicts this change request.
Consider a cachable show action for a seminar date. This view can be fully cached, it mostly never changes.
In case the seminar date has to be cancelled, the state of the seminar date is changed and the respective cache entry is flushed.
The show action then issues a redirect to an overview page, in case the page for this seminar date is still accessed by someone.
The redirect is so to say permanent, but since the core does not store the HTTP headers with the cache content, this redirect response must not be cached.
Updated by Gerrit Code Review over 5 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60518
Updated by Helmut Hummel over 5 years ago
Thanks for the use case. There would have been multiple ways to achieve desired behavior without introducing such core change, which seems pretty intrusive to me.
- Using HttpUtility::redirect (or throw new DirectResponseException in 9.5 and higher)
- Disabling the page cache using TSFE->set_no_cache (which is done e.g. in News extension)
- Throw a 404 and handle the 404 accordingly in a custom 404 handler
- Convert the plugin to USER_INT before issuing the redirect
I added the last to Extbase redierctToUri as I don't see a use case for issuing a redirect and at the same time have the same plugin action cached (which only works currently at cost of always rendering the complete page, writing and then again removing the page cache)
Updated by Gerrit Code Review over 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60684
Updated by Helmut Hummel over 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6c38e760b58de09f8934718659d857c5dfeee42f.
Updated by Gerrit Code Review over 5 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60687
Updated by Helmut Hummel over 5 years ago
- Status changed from Under Review to Resolved
Applied in changeset 5c60f470dcd5434901831b6b837df1757651e040.