Project

General

Profile

Actions

Bug #88178

closed

Page cache is deleted, when an uncached (Extbase) Plugin performs a redirect

Added by Helmut Hummel almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2019-04-19
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #83755: Extbase TYPO3\CMS\Extbase\Mvc\Controller\AbstractController->redirectToUri() – remove HTML redirect?Rejected2018-02-02

Actions
Actions #1

Updated by Helmut Hummel almost 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.

Actions #2

Updated by Gerrit Code Review almost 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

Actions #3

Updated by Helmut Hummel almost 5 years ago

  • Related to Bug #83755: Extbase TYPO3\CMS\Extbase\Mvc\Controller\AbstractController->redirectToUri() – remove HTML redirect? added
Actions #4

Updated by Markus Klein almost 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.

Actions #5

Updated by Gerrit Code Review almost 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

Actions #6

Updated by Helmut Hummel almost 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.

  1. Using HttpUtility::redirect (or throw new DirectResponseException in 9.5 and higher)
  2. Disabling the page cache using TSFE->set_no_cache (which is done e.g. in News extension)
  3. Throw a 404 and handle the 404 accordingly in a custom 404 handler
  4. 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)

Actions #7

Updated by Gerrit Code Review almost 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

Actions #8

Updated by Helmut Hummel almost 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Gerrit Code Review almost 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

Actions #10

Updated by Helmut Hummel almost 5 years ago

  • Status changed from Under Review to Resolved
Actions #11

Updated by Benni Mack almost 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF