lochmueller / staticfilecache

🚀 Fastest TYPO3 Extension ever 🚀
https://packagist.org/packages/lochmueller/staticfilecache
GNU General Public License v3.0
116 stars 65 forks source link

SOME pages are not delivered cached #120

Closed the-hotmann closed 5 years ago

the-hotmann commented 5 years ago

Bug Report

Current Behavior When I call a page which should be cached but I get linked to this page, this page will not get delivered cached. Maybe also because it is invisible in the menu.

Expected behavior/output Should also get delivered staticaly cached

Environment

Possible Solution Also try to find the difference in sites which you reach with a reference to and directly and make referenced sites also cachable.

Additional context The sites which are not working are just plain text (Imprint etc) not even a pic/form etc I will upload a pic which shows the pages which are causing problems. typo3 verweis

All the pages which are under "Wichtige Seiten" are linking to invisible pages which should not appear on the main menu but just under "Wichtige Seiten". I guess this happens because the pages you should get linked to are invisible or because you get linked to them. But Why should pages which are JUST in the Menu invisible not be cached?

lochmueller commented 5 years ago

Hmm... "Invisible" means "Hide in menu", right? "Invisible" (disabled) pages are not cached at all (TYPO3 internal). I test to cache "Hide in menu" pages and there is no effect that prevent caching of this pages. The field is also noch check in the extension. Seams a configuration issue in your TYPO3 installation? Do you get information in the info-module? Do you call the page with a speaking URL? is the cHash the right one? Do you call the page with a clean session?

I need some more information...

Keep in mind. Menu generation do not effect the generation of the Staticfilecache. It is always the rendering of the single page that check if the page is fully cachable.

Regards, Tim

the-hotmann commented 5 years ago

Hi Tim, yes Invisible means "Hide in menu". So this pages are not disabled, they just do not show up in the menu.

I'm on Typo3 9 so I always call these pages with Speaking URL as this is standard in Typo3 9. I do not use any thirth party realURL or speakingURL extension.

I just cleared the cache some more times and somehow it seems to be like this:

When I call the page from a link (Verweis) to this site it will not get cached properly. When I call the page (even the invisible) directly it will be cached directly.

Btw I solved this problem with another menu structure and now its working but this "bug" is worth a look.

Edit

This problem is still here: its just complete random. Sometimes sites does not get cached, randomly. If you change something at a page then save. Open the page as admin and see the difference. Open the edited page in a anonym tab and see the old Version. Now preff STRG + F5 to force refresh and now you see the edited page with the edits but its not getting delivered cached.

Also other pages are randomly not fireing a 304 header but a 200 which means the page is not static cached and have to be delivered from Typo3 Cache which is slower.

Edit2

to answer your questions: 1.) No I also tested it on a clean Typo3 9 install with BootstrapPackage, so this is no config issue at my Typo3 installation 2.) Yes I get infos from the info module, but they are 100% wrong. I just have 1 single normal input field for the impressum there. static file cache 3.) yup cHash is right. 4.) yes for testing this I always call the page from a anonym/incognito tab.

the-hotmann commented 5 years ago

Here the imprint (Impressum) which cant be cached but I dont get why becasue there is just one field which is 100% not dynamicaly and got cached at the start page.

impressum

The problem also cant be the fact this page being placed after a invisible page, because all of these pages are placed after the same invisible page (also /partner which is cachable !? ) the structure is now:

wichtige seiten

Wichtige Seiten -> Impressum (not cached) -> Datenschutz (not cached) -> Partner (CACHED!!!) -> 404 -> Danke für Ihre Nachricht

chesio commented 5 years ago

This problem is still here: its just complete random. Sometimes sites does not get cached, randomly.

Just a blind guess, but I got similar impression about Static File Cache being broken when I had form on my website and it was "randomly" preventing pages from caching due to this issue: https://docs.typo3.org/typo3cms/extensions/form/latest/FAQ/Index.html#the-honeypot-does-not-work-with-static-site-caching-what-can-i-do

Might be your case maybe?

lochmueller commented 5 years ago

Next hint: "The page is not cachable via TypoScript Frontend" as a huge set of problems (the core send not more details in this case). BUT: There is the "set_no_cache" in the TSFE. You could set... $GLOBALS['TYPO3_CONF_VARS']['FE']['disableNoCacheParameter'] = true; ... delete all caches and try again. If the cache is build the problem are other processes that disable the cache. Often realurl/cHash is the problem. E.g. some bypass parameter lead to invalid cHash calculation...

Furthermore: This is no problem of StaticFileCache, so I close this issue. If you have any news, feel free to add some details or the solution and I try to respond, if you need mor information, but the problems seems to be your TYPO3 configuration and/or other mechanims/plugins...

Regards, Tim

lochmueller commented 5 years ago

Next hint: Enable the sysLog to get the debug message of the set_no_cache calls.

the-hotmann commented 5 years ago

This problem is still here: its just complete random. Sometimes sites does not get cached, randomly.

Just a blind guess, but I got similar impression about Static File Cache being broken when I had form on my website and it was "randomly" preventing pages from caching due to this issue: https://docs.typo3.org/typo3cms/extensions/form/latest/FAQ/Index.html#the-honeypot-does-not-work-with-static-site-caching-what-can-i-do

Might be your case maybe?

Thanks for this hint, but actually this was not the problem. The pages which is not getting cached was my imprint. No Forms there. All the form at other oages got cached .. pretty weird.

But setting: ['disableNoCacheParameter'] = true; was helping. Hope it will not break anything else

lochmueller commented 5 years ago

If "disableNoCacheParameter" helps, it is a configuration issue. I suggest to debug into "set_no_cache" to find the real problem.... Regards, Tim

the-hotmann commented 5 years ago

If "disableNoCacheParameter" helps, it is a configuration issue. I suggest to debug into "set_no_cache" to find the real problem.... Regards, Tim

Could you pls tell me how to exactly do so?

Its just pretty strange that this extension is sometimes caching a page (like the imprint) and sometimes not. Like its not doing all the time the same. I have 4 different Typo3 installations where I'm testing this, one based on pure bootstrap_package but somehow all of these have the same problem.

If you tell me how to debug this I would love to do so. I already activated Settings > Configuration Presets > Debug (custom to even show warnings) But the Typo3 Log is empty. Like the Serverlog. Well normal logentrys but not even one warning.

chesio commented 5 years ago

Thanks for this hint, but actually this was not the problem. The pages which is not getting cached was my imprint. No Forms there. All the form at other oages got cached .. pretty weird.

The issue with forms is more complex: the honey pot protection (that is on by default) creates an anonymous front-end session that prevents any subsequently visited pages from being static cacheable, because \TYPO3\CMS\Frontend\Controller\TyposcriptFrontendController->isStaticCacheble() returns false when there's a front-end session active. See more info here: https://forge.typo3.org/issues/83212

As a result, if a non-cached page is first visited by a user that previously visited a page with a form on it (= has front-end session active), the page will be marked as not static cacheable (and will stay in this state until removed from TYPO3 cache). If the user has not visited form page before, the page will be stored in static cache.

So if you use forms from EXT:form, try disabling honeypot protection as described here and see if that helps: https://docs.typo3.org/typo3cms/extensions/form/latest/Config/proto/formElements/formElementTypes/Form.html#typo3-cms-form-prototypes-prototypeidentifier-formelementsdefinition-form-renderingoptions-honeypot-enable