0
votes

This error occures in TYPO3 7.6.10 with a piBase extension and realurl 2.0.15:

In this extension, I'm checking for a GET parameter, e.g. a country. If this parameter is not provided, I redirect to the same page, with default country as parameter:

if(!$this->piVars['country']) {
  $this->piVars['country'] = 'germany';
  \TYPO3\CMS\Core\Utility\HttpUtility::redirect($this->pi_linkTP_keepPIvars_url(array(), true), \TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_303);
}

That means, the visitor e.g. calls url www.mypage.com/list/ and is redirected to www.mypage.com/list/germany/

This works fine, but after some time passes and some visitors were an the page, the redirect stopped working. When opening www.mypage.com/list/ in the browser, the page is displayed for some country (not the default one, e.g. for country "france"). That means, TYPO3 creates on page www.mypage.com/list/france/ a cache entry for page www.mypage.com/list/, but for this url, a cache entry should've never been created, because of the redirect.

I can reproduce this error by setting caching time of the page to 1 minute. Then I wait one minute, then loading the url www.mypage.com/list/france/. Now, when opening www.mypage.com/list/, there is no redirect and france is shown.

When disabling realurl (or just removing parameter "country" from realurl configuration), this error doesn't occur.

2
Which TYPO3 version?Jost
Are you using chash caching and do you have your parameter included in the chash calculations?Jozef Spisiak
TYPO3 6.2.15 and 7.6.10Sven
When I disable realurl, I see the cHash parameter for the links generated by the extension. I also do not exclude parameter "country" in "cHashExcludedParameters", so I assume, this parameter is included in the cHash calculation.Sven
I can reproduce this error: I set caching time of the page to 1 minute. Then I wait one minute, then loading the url www.mypage.com/list/france/. Now, when opening www.mypage.com/list/, there is no redirect and france is shown.Sven

2 Answers

1
votes

TYPO3 stores in cache so-called "versions" of a page with corresponding cHash and additionaly a version without cHash - kind of a "default" page.

If something wrong happens, when cHash is validated by the core, it gets rejected and page is generated, using provided params in url.

In case of very first hit (cache is empty) and a wrong cHash page is generated, using the params from URL, but due to a wrong cHash this version is then understood as "default" and stored in cache.

The real reason you need to find in your code. It can be a wrong combination of RealURL configuration and code. E.g. enableCHashCache is set to false in RealURL configuration, but link is provided w/out cHash.

I can't tell you the exact reason, but you can check it different ways:

  1. Set FE - pageNotFoundOnCHashError at Install Tool and check if 404 error happens, when you visit www.mypage.com/list/france/

  2. Disable RealURL and visit different versions of a page with different country values - does cHash change for different countries or stays the same?

  3. Check the url, generated by pi_linkTP_keepPIvars_url() with and without RealURL. Does it contain cHash?

1
votes

The problem is described here: realurl generates entries without cHash

Since version 2.0.15, realurl doesn't calculate the cHash parameter for links, which are accessed directly and which need a cHash parameter to show the right cached contents, like detail pages of a record.