Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


mattab

9 posts

Wannabe Geek


#82766 5-May-2011 11:57
Send private message

Hello,

I am using Telstraclear internet connection, based in Wellis

I have a problem: when I request a given file on a server, while it appears the http headers are set properly, I find that when using telstra clear internet connection, a request that should return HTTP 304 (found in local cache) instead always returns HTTP 200, causing a new download of a file that hasn't changed since I downloaded it originally.

The particular request is: http://demo.piwik.org/index.php?module=Proxy&action=getCss&piwik=1.4

When I request this page, I see in firebug the following headers:

Host: demo.piwik.org
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en,fr-ca;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 3
Connection: keep-alive
If-Modified-Since: Wed, 04 May 2011 21:31:29 GMT

Note the "If-Modified-Since"

The response headers are:

Date: Wed, 04 May 2011 23:37:12 GMT
Server: Apache
Cache-Control: public, must-revalidate
Vary: Accept-Encoding,User-Agent
Content-Disposition: inline; filename=asset_manager_global_css.css
Last-Modified: Wed, 04 May 2011 21:31:29 GMT
Content-Type: text/css
Via: 1.1 bc3
Content-Length: 12627
Connection: Keep-Alive
Content-Encoding: deflate

As you can see the Last-modified date is the same as the request, so the file hasn't changed. It should therefore return 304.

However, in all cases the browser will re-download the file.

For example this is a screenshot of Chrome Network panel showing the same thing:



I have found that using other internet connections the problem doesn't happen.

Note, that I control the code serving this file, so I could change the headers if the headers we set are indeed the problem (but they work fine for everybody else)

Notice the header "Via: 1.1 bc3" in the response. So, maybe the telstra clear proxy somehow invalidates the response and forces the browser to download the file?

I must admit that I don't understand how it happens. It would be great to learn how I could either fix this problem, or have a workaround to somehow not go through the telstraclear proxy, which maybe is causing this issue?

Many thanks for your help!

Matt



Create new topic
mattab

9 posts

Wannabe Geek


  #465683 5-May-2011 12:16
Send private message

Just to confirm because it's not clear in my post, the server indeed returns HTTP 304: [05/May/2011:02:13:10 +0200] "GET /index.php?module=Proxy&action=getCss&piwik=1.4&test2 HTTP/1.0" 304 - "-" "Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"

BUT this is changed into 200 by Telstra clear proxy... Any advice greatly appreciated!

Crankshaw
5 posts

Wannabe Geek


  #465795 5-May-2011 15:27
Send private message

Hi Mattab,

Having looked at the response headers it looks like the Expires: and Pragma: headers in the response for that specific url are blank.   A quick check of the cache shows that it isn't actually storing this object (this can also be inferred from the lack of an Age: header in the response, which is inserted by these caches to indicate how long it's been stored for).

I doubt you'll see these after having gone through the cache as they'll be considered invalid.  They will however be visible from an uncached connection if you have access to one as suggested above or by pasting that url into http://redbot.org  (wish also gives a nice little analysis of the headers).

While it may not be strictly needed for an IMS comparison, I suspect that the blank headers are causing the cache to decide that it's expired or is giving up trying to figure out whats going on and is thus serving the whole object.  Are you able to modify those two headers for that object and try again?

 
 
 
 


mattab

9 posts

Wannabe Geek


  #466024 6-May-2011 07:51
Send private message

Crankshaw, thanks for your answer. Thanks for the redbot tip also.

With your tips I found out that it is the lack of the Expires: header that is causing the response not to be cached.

However, there is a good reason we don't set the "Expires:" header: we do not know when the file will be invalidated (ie. it is rebuilt at random times when we update the CSS).

So, if I set it in the future (ie 1 day from now) and if we change the file before then, for example in 1 hour, then the browser will not even request the Headers for that file until 1 day in the future, so it won't know that the file has now changed.

How can we have the telstra clear proxy cache the file, without using the Expires: header in the response?
Thanks

mattab

9 posts

Wannabe Geek


  #466028 6-May-2011 08:01
Send private message

After posting the solution appeared: to force re-download, the file URL should be different so that it forces a fresh download.. In fact, we already have a cache buster parameter in the URL, so that when the file changes, it will indeed force a re-download in any case. I think my problem is solved :)

THANKS!!!

freitasm
BDFL - Memuneh
68897 posts

Uber Geek

Administrator
Trusted
Geekzone
Lifetime subscriber

  #466037 6-May-2011 08:30
Send private message

Generate a new random file name for the CSS file so it's never the same and then bypasses any existing cached file?





 

 

These links are referral codes

 

Geekzone broadband switch | Eletcricity comparison and switch | Hatch investment (NZ$ 10 bonus if NZ$100 deposited within 30 days) | Sharesies | Mighty Ape | Backblaze | Coinbase | TheMarket | My technology disclosure


mattab

9 posts

Wannabe Geek


  #466041 6-May-2011 09:01
Send private message

freitasm, yes that's what I posted in my self post answer ;)

Thanks again guys :)

freitasm
BDFL - Memuneh
68897 posts

Uber Geek

Administrator
Trusted
Geekzone
Lifetime subscriber

  #466043 6-May-2011 09:02
Send private message

Sorry... Saw the earlier posts - before yours - but only posted my reply later. That's how long it took me to go to the kitchen and get a coffee ;)





 

 

These links are referral codes

 

Geekzone broadband switch | Eletcricity comparison and switch | Hatch investment (NZ$ 10 bonus if NZ$100 deposited within 30 days) | Sharesies | Mighty Ape | Backblaze | Coinbase | TheMarket | My technology disclosure


Create new topic





News »

Vodafone enables 5G roaming - for when international travel comes
Posted 30-Oct-2020 15:03


Spark awards funding to Kiwi businesses in 5G funding initiative
Posted 30-Oct-2020 14:58


Huawei launches IdeaHub Pro in New Zealand
Posted 27-Oct-2020 16:41


Southland-based IT specialist providing virtual services worldwide
Posted 27-Oct-2020 15:55


NASA discovers water on sunlit surface of Moon
Posted 27-Oct-2020 08:30


Huawei introduces new features to Petal Search, Maps and Docs
Posted 26-Oct-2020 18:05


Nokia selected by NASA to build first ever cellular network on the Moon
Posted 21-Oct-2020 08:34


Nanoleaf enhances lighting line with launch of Triangles and Mini Triangles
Posted 17-Oct-2020 20:18


Synology unveils DS16211+
Posted 17-Oct-2020 20:12


Ingram Micro introduces FootfallCam to New Zealand channel
Posted 17-Oct-2020 20:06


Dropbox adopts Virtual First working policy
Posted 17-Oct-2020 19:47


OPPO announces Reno4 Series 5G line-up in NZ
Posted 16-Oct-2020 08:52


Microsoft Highway to a Hundred expands to Asia Pacific
Posted 14-Oct-2020 09:34


Spark turns on 5G in Auckland
Posted 14-Oct-2020 09:29


AMD Launches AMD Ryzen 5000 Series Desktop Processors
Posted 9-Oct-2020 10:13









Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.