homepage Welcome to WebmasterWorld Guest from 54.234.60.133
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Header set or append?
What is the difference if any?
mihomes




msg:4627197
 3:40 pm on Dec 2, 2013 (gmt 0)

I recently came upon a situation where I was using php and ajax to open a 'modal' after button click. I could not for the life of me understand why the dynamic content inside the modal was not updating after the first time it was clicked.

My htaccess had :

<FilesMatch "\.(html?|php)$">
ExpiresDefault "access plus 2 days"
Header append Cache-Control "private, must-revalidate"
</FilesMatch>


I changed this to the following and now all was fine :

<FilesMatch "\.(html?|php)$">
ExpiresDefault "access plus 0 seconds"
Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0"
Header set Pragma "no-cache"
</FilesMatch>


I had looked up some information on proper 'nocache' settings and did a simple copy paste.

This, however, bought up the question... what is the difference between 'Header set' and 'Header append'?

From a working standpoint I see no difference. I changed new code to append and it worked fine. I have used append in these rules for years not thinking twice until now. I did some searching and didn't come across much.

What is the difference between these two? Logic of course says one is appended (added to the end), but what is the real difference here?

 

lucy24




msg:4627238
 5:04 pm on Dec 2, 2013 (gmt 0)

You can think of it as analogous to [QSA] in mod_rewrite. With "Header append" you will potentially end up with two different values for the same thing. And then the recipient-- in this case the browser-- has to decide which one to use. So if your existing Cache-control and/or Pragma header already has a default value that's different from what you're now saying, the browser might choose to go with the first thing it sees.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved