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
59053 posts

Uber Geek
+1 received by user: 10336

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

Uber Geek
+1 received by user: 10336

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

UFB killer app: Speed
Posted 17-Nov-2017 17:01


The case for RSS — MacSparky
Posted 13-Nov-2017 14:35


WordPress and Indieweb: Take control of your online presence — 6:30 GridAKL Nov 30
Posted 11-Nov-2017 13:43


Chorus reveals technology upgrade for schools, students
Posted 10-Nov-2017 10:28


Vodafone says Internet of Things (IoT) crucial for digital transformation
Posted 10-Nov-2017 10:06


Police and Facebook launch AMBER Alerts system in NZ
Posted 9-Nov-2017 10:49


Amazon debuts Fire TV Stick Basic Edition in over 100 new countries
Posted 8-Nov-2017 05:34


Vodafone VoIP transition to start this month
Posted 7-Nov-2017 12:33


Spark enhances IoT network capability
Posted 7-Nov-2017 11:33


Vocus NZ sale and broadband competition
Posted 6-Nov-2017 14:36


Hawaiki reaches key milestone in landmark deep-sea fibre project
Posted 4-Nov-2017 13:53


Countdown launches new proximity online shopping app
Posted 4-Nov-2017 13:50


Nokia 3310 to be available through Spark New Zealand
Posted 4-Nov-2017 13:31


Nest launches in New Zealand
Posted 4-Nov-2017 12:31


Active wholesale as Chorus tackles wireless challenge
Posted 3-Nov-2017 10:55



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.