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

[4.0] Caching of headers does not work for views #35117

Open
elpescador-nl opened this issue Aug 14, 2021 · 3 comments
Open

[4.0] Caching of headers does not work for views #35117

elpescador-nl opened this issue Aug 14, 2021 · 3 comments

Comments

@elpescador-nl
Copy link

Steps to reproduce the issue

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"

Expected result

The Content-disposition: attachment; filename="John Smith.vcf" header is always present. Also when delivering a cached version.

Actual result

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.

System information (as much as possible)

  • Joomla! 4.0.0-rc6 Release Candidate
  • php-fpm
  • nginx

Additional comments

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');
@elpescador-nl
Copy link
Author

I already found out the headers are not being stored in the cache at all.

if (isset($options['headers']) && $options['headers'])

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.

@PhilETaylor

This comment was marked as abuse.

@elpescador-nl
Copy link
Author

@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.

@Hackwar Hackwar added the bug label Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants