homepage Welcome to WebmasterWorld Guest from 54.167.138.53
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

    
Setting Cache headers different for CDN and browser
castor_t

5+ Year Member



 
Msg#: 4417242 posted 5:44 am on Feb 14, 2012 (gmt 0)

Is it possible to set different headers for CDN and for my end user? I use origin pull for my CDN and it honors the caching headers that I set.

So, if i put, max-age header to two days, my CDN will cache the page for two days.

I use header("Cache-Control: maxage=172800, public") in my PHP code.

But I guess the browser of my site visitor will also cache the page for two days and will not send a new request on second or further requests to the page. Is it possible not to set headers for the browser, but for the CDN?

 

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4417242 posted 1:55 pm on Feb 14, 2012 (gmt 0)

does the browser get a Cache-Control header from the CDN or an Expires header?

castor_t

5+ Year Member



 
Msg#: 4417242 posted 4:08 am on Mar 30, 2012 (gmt 0)

The browser gets the Cache-Control header from the CDN.

In fact, the CDN forwards the cache headers set by my website.

Webserver => CDN => User

I want to set the header for CDN to cache content for 2 days, but the User should see the cache header set for 10 minutes. The reason is, I can manually purge the cache from the CDN whenever I update the content.

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4417242 posted 12:38 pm on Mar 30, 2012 (gmt 0)

i would first check to see if there are custom/proprietary headers available for your CDN service that would get stripped before forwarding to browser requests.

castor_t

5+ Year Member



 
Msg#: 4417242 posted 1:55 pm on Mar 30, 2012 (gmt 0)

My CDN forwards all the headers that were sent to it. Does something like public for visitors and must-revalidate for CDN work?

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4417242 posted 2:29 pm on Mar 30, 2012 (gmt 0)

according to the Hypertext Transfer Protocol -- HTTP/1.1

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
Cache directives MUST be passed through by a proxy or gateway application, regardless of their significance to that application, since the directives might be applicable to all recipients along the request/response chain. It is not possible to specify a cache- directive for a specific cache.


this means you won't fix this without a CDN-specific cache control header.

castor_t

5+ Year Member



 
Msg#: 4417242 posted 3:35 am on Apr 1, 2012 (gmt 0)

Seems, I have no solution to this problem. Thanks anyway.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved