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.




9 posts

Wannabe Geek


Topic # 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


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

 
 
 
 




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?
Thanks



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

THANKS!!!

BDFL - Memuneh
59413 posts

Uber Geek
+1 received by user: 10624

Administrator
Trusted
Geekzone
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
59413 posts

Uber Geek
+1 received by user: 10624

Administrator
Trusted
Geekzone
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 »

New Zealand hits peak broadband data
Posted 18-Jan-2018 12:21


Amazon Echo devices coming to New Zealand early February 2018
Posted 18-Jan-2018 10:53


$3.74 million for new electric vehicles in New Zealand
Posted 17-Jan-2018 11:27


Nova 2i: Value, not excitement from Huawei
Posted 17-Jan-2018 09:02


Less news in Facebook News Feed revamp
Posted 15-Jan-2018 13:15


Australian Government contract awarded to Datacom Connect
Posted 11-Jan-2018 08:37


Why New Zealand needs a chief technology officer
Posted 6-Jan-2018 13:59


Amazon release Silk Browser and Firefox for Fire TV
Posted 21-Dec-2017 13:42


New Chief Technology Officer role created
Posted 19-Dec-2017 22:18


All I want for Christmas is a new EV
Posted 19-Dec-2017 19:54


How clever is this: AI will create 2.3 million jobs by 2020
Posted 19-Dec-2017 19:52


NOW to deploy SD-WAN to regional councils
Posted 19-Dec-2017 19:46


Mobile market competition issues ComCom should watch
Posted 18-Dec-2017 10:52


New Zealand government to create digital advisory group
Posted 16-Dec-2017 08:47


Australia datum changes means whole country moving 1.8 metres north-east
Posted 16-Dec-2017 08:39



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.