Where to override Cache-Control/Pragma?
Permalink
Hi again, a quick question:
I'd like to try to use my own Cache-Control/Pragma header control, but I can't seem to find the file to override by doing a grep for any relevant term I can think of. Where is this set for pages? I did find it for downloaded files but that doesn't seem to be used for the actual pages.
I'd like to try to use my own Cache-Control/Pragma header control, but I can't seem to find the file to override by doing a grep for any relevant term I can think of. Where is this set for pages? I did find it for downloaded files but that doesn't seem to be used for the actual pages.
I think I couldn't find any cache-controls either.. But probably because there are none?
Well, something must be setting the cache parameters as I can see in the HTTP headers that there's a custom Cache-Control as well as Pragma header. But as to where it might be set... I can't think it's set by Apache though, there's nothing in the .htaccesses/httpd.conf that I use that I believe is related to caching. Unless mod_rewrite magically modifies those two headers?
I see what you mean..
I don't think it's mod_rewrite because of two reasons:
- When calling index.php directly, the headers are there as well
- A c5 site of mine running on nginx returns the same headers
I wonder how Andrew & his team were able to set the pragma without using header('pragma.. I keep digging..
I don't think it's mod_rewrite because of two reasons:
- When calling index.php directly, the headers are there as well
- A c5 site of mine running on nginx returns the same headers
I wonder how Andrew & his team were able to set the pragma without using header('pragma.. I keep digging..
check startup/session.php
don't know why this sets the pragma but it seems to me that php doesn't want to cache a page using sessions..
if you temporary remove these session methods, there's no pragma anymore.. hmm
don't know why this sets the pragma but it seems to me that php doesn't want to cache a page using sessions..
if you temporary remove these session methods, there's no pragma anymore.. hmm
See post that I was typing while you sent yours. :D
I was 4 minutes faster (:
How are you going to implement this "selective caching method"? Do you already have a page object at that time? (Can you use a page attribute)
But sounds like a good idea to do this for some pages..
How are you going to implement this "selective caching method"? Do you already have a page object at that time? (Can you use a page attribute)
But sounds like a good idea to do this for some pages..
I didn't think it was going to be in such a "basal" place as the session init, so I guess I'll have to think this one through thoroughly.
I was intending to use the Page object, but if that's not available I guess I'd have to resort to URL matching - but what if the page is specified by cId? What if it's in edit mode - I wouldn't want to cache that?
Also, as I intended this to possibly store the parameters used for matching pages in the database, I'll have to look into whether I can actually use it as I thought I would be able to, but as it at least runs within the C5_EXECUTE "context" perhaps at least this part is doable.
Guess I'll have to study load and setup order. Or some interesting echo's and print_r's to figure things out. :)
I was intending to use the Page object, but if that's not available I guess I'd have to resort to URL matching - but what if the page is specified by cId? What if it's in edit mode - I wouldn't want to cache that?
Also, as I intended this to possibly store the parameters used for matching pages in the database, I'll have to look into whether I can actually use it as I thought I would be able to, but as it at least runs within the C5_EXECUTE "context" perhaps at least this part is doable.
Guess I'll have to study load and setup order. Or some interesting echo's and print_r's to figure things out. :)
In concrete/dispatcher.php, everything I need seems to be loaded before the session setup, but $c is defined after. Either I duplicate it in my version of session.php - which _has_ to live in concrete/startup per the current release, or I move the assignment stuff (but not the error check, I guess) above the session setup in the dispatcher. Of course, this also has to live under concrete/, or I'd have to change the index.php as well.
Hm. I didn't think custom caching would be, well, so custom. :D
Hm. I didn't think custom caching would be, well, so custom. :D
For some reason I started to suspect that this might have to do with some kind of session management. Turns out that concrete/startup/session.php seems to use PHP's session_start().
http://us2.php.net/manual/en/function.session-cache-limiter.php... gives that session_start() sets Expires, Pragma and whatnot according to the ini setting session.cache_limiter - which just happens to default (at least on this particular server) to nocache...
So, to change this I suppose I should override session.php as session_cache_limiter() needs to be called before every session_start(). (I want to selectively change caching in different ways for different pages - a change in php.ini is not practical.)
http://us2.php.net/manual/en/function.session-cache-limiter.php... gives that session_start() sets Expires, Pragma and whatnot according to the ini setting session.cache_limiter - which just happens to default (at least on this particular server) to nocache...
So, to change this I suppose I should override session.php as session_cache_limiter() needs to be called before every session_start(). (I want to selectively change caching in different ways for different pages - a change in php.ini is not practical.)