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

9 posts

Wannabe Geek

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


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:

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

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!


Create new topic

9 posts

Wannabe Geek

  Reply # 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!

5 posts

Wannabe Geek

  Reply # 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  (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?


9 posts

Wannabe Geek

  Reply # 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?

9 posts

Wannabe Geek

  Reply # 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 :)


BDFL - Memuneh
59828 posts

Uber Geek
+1 received by user: 10931

Lifetime subscriber

  Reply # 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?

9 posts

Wannabe Geek

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

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

Thanks again guys :)

BDFL - Memuneh
59828 posts

Uber Geek
+1 received by user: 10931

Lifetime subscriber

  Reply # 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 ;)

Create new topic

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:

Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:

Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:

News »

Stuff Pix enters streaming video market
Posted 21-Mar-2018 09:18

Windows no longer Microsoft’s main focus
Posted 13-Mar-2018 07:47

Why phone makers are obsessed with cameras
Posted 11-Mar-2018 12:25

New Zealand Adopts International Open Data Charter
Posted 3-Mar-2018 12:48

Shipments tumble as NZ phone upgrades slow
Posted 2-Mar-2018 11:48

Oppo R11s: high-end Android, budget price
Posted 27-Feb-2018 16:27

Samsung New Zealand introducing the Galaxy S9 and S9+
Posted 26-Feb-2018 07:00

Fujifilm X beats its best with new top of the range, high-performance camera
Posted 24-Feb-2018 14:05

One million kiwis affected by cybercrime
Posted 24-Feb-2018 13:58

New Zealanders want to engage with government online and via mobile apps
Posted 24-Feb-2018 13:56

Samsung launches Samsung Max
Posted 24-Feb-2018 13:52

CPTPP text and National Interest Analysis released for public scrutiny
Posted 21-Feb-2018 19:43

Foodstuffs to trial digitised shopping trolleys
Posted 21-Feb-2018 18:27

2018: The year of zero-login, smart cars & the biometrics of things
Posted 21-Feb-2018 18:25

Intel reimagines data centre storage with new 3D NAND SSDs
Posted 16-Feb-2018 15:21

Geekzone Live »

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

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.