Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Fix middleware order for forced indexing (crawler 11) #1019

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

cweiske
Copy link
Contributor

@cweiske cweiske commented May 26, 2023

(Backport of #1018 to v11.x)

History:

Because of a problem with lochmueller/staticfilecache, crawler issue #642 changed the middleware loading order to execute crawler after static file cache. (commit 0f7cb6a)

The source of the problem was that the crawler CrawlerInitialization middleware overwrote the HTTP response that was generated by TYPO3.

Since commit 8a9b896 (issue #837) the HTTP response is not destroyed/overwritten by crawler anymore but moved into a HTTP header "X-T3Crawler-Meta".
The loading order does not influence compatibility with static file cache anymore.

Bug

The changed loading order in the bug fix led to the problem that

indexed_search:TypoScriptFrontendHook
was executed before
crawler:CrawlerInitialization

But CrawlerInitialization must be run before TypoScriptFrontendHook because it loads request data that are needed by indexed_search.

This led to bug #729

  • forced reindexing by the crawler did not work anymore if the page was already in cache.

Solution

Restore the HTTP middleware loading order as it was before the fix for #642, so that the code path is again:

  1. crawler:FrontendUserAuthenticator (aoe/crawler/authentication)

  2. crawler:CrawlerInitialization (aoe/crawler/initialization)

  3. indexed_search:TypoScriptFrontendHook (called by typo3/cms-frontend/prepare-tsfe-rendering)

Resolves: #729

History:
--------
Because of a problem with lochmueller/staticfilecache,
crawler issue tomasnorre#642
changed the middleware loading order to execute crawler after static file cache.
(commit 0f7cb6a)

The source of the problem was that the crawler CrawlerInitialization middleware
overwrote the HTTP response that was generated by TYPO3.

Since commit 8a9b896
(issue tomasnorre#837)
the HTTP response is not destroyed/overwritten by crawler anymore
but moved into a HTTP header "X-T3Crawler-Meta".
The loading order does not influence compatibility with
static file cache anymore.

Bug
---
The changed loading order in the bug fix led to the problem that
> indexed_search:TypoScriptFrontendHook
was executed before
> crawler:CrawlerInitialization

But CrawlerInitialization must be run before TypoScriptFrontendHook
because it loads request data that are needed by indexed_search.

This led to bug tomasnorre#729
- forced reindexing by the crawler did not work anymore if the
page was already in cache.

Solution
--------
Restore the HTTP middleware loading order as it was before
the fix for tomasnorre#642, so that the code path is again:

1. crawler:FrontendUserAuthenticator
   (aoe/crawler/authentication)

2. crawler:CrawlerInitialization
   (aoe/crawler/initialization)

3. indexed_search:TypoScriptFrontendHook
   (called by typo3/cms-frontend/prepare-tsfe-rendering)

Resolves: tomasnorre#729
@stale
Copy link

stale bot commented Jul 25, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the staled label Jul 25, 2023
@cweiske
Copy link
Contributor Author

cweiske commented Jul 26, 2023 via email

@stale stale bot removed the staled label Jul 26, 2023
@tomasnorre tomasnorre merged commit d8097e7 into tomasnorre:v11.x Feb 13, 2024
@cweiske cweiske deleted the middleware-order-11 branch February 14, 2024 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants