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

Uber Geek

Administrator
ID Verified
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?





Please support Geekzone by subscribing, or using one of our referral links: Quic Broadband (free setup code: R587125ERQ6VE) | Samsung | AliExpress | Wise | Sharesies | Hatch | GoodSync 


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

Uber Geek

Administrator
ID Verified
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 ;)





Please support Geekzone by subscribing, or using one of our referral links: Quic Broadband (free setup code: R587125ERQ6VE) | Samsung | AliExpress | Wise | Sharesies | Hatch | GoodSync 


Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









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.