Enable the cache (it does not matter which engine, I tested with redis and file caching). Do not use the Page caching plugin.
The easiest way with an out-of-the-box J!4 installation...
The vcf download of a contact has an extra added header Content-disposition
with the card_name in the file name. For example attachment; filename="John Smith.vcf"
The Content-disposition: attachment; filename="John Smith.vcf"
header is always present. Also when delivering a cached version.
The Content-disposition: attachment; filename="John Smith.vcf"
header is only present the first time the vcf is loaded. With the cached version this header disappeared.
As I said this header is just an example. You could also test it by adding this code to a view you want to test:
Factory::getApplication()->setHeader('x-cachetest', 'hello');
Labels |
Added:
No Code Attached Yet
|
Do not use the Page caching plugin.
Isn't this then the correct behaviour? If you are not caching the whole page - with headers - then you cannot expect headers to be resent from cache.
Joomla confuses many with its terminology and "caching" has many meanings in Joomla (Its used to describe Object caching (like db results), HTML Fragment caching, View caching!)
@PhilETaylor , in my first comment I stated this works perfectly for J!3.9 (J!3.10) but I was mistaken. It doesn't work there either.
I've found a work around for this issue and using the page cache plugin on top of it prevents it from happening as it seems. So not a big priority I think.
Though it looks a bit strange to me that by activating the cache (and not the page cache) custom component headers are only sent when there is a cache miss.
Labels |
Added:
bug
|
I already found out the headers are not being stored in the cache at all.
joomla-cms/libraries/src/Cache/Cache.php
Line 748 in 72e78f4
When I force this if-clause to be true (change it to
if(true)
) the header is being stored. I don't think this is the solution, but it might help finding the good solution. I hope this find might help someone with more knowledge of the Caching layer to solve the problem.In J!3.9 it all works perfectly. I tried to compare the J!4 code with it, but did not get my head around it.