PDA

View Full Version : Resin 4.x on Centos - Resin Webserver not allowing locally cached images


jdamnation
09-21-2010, 09:10 AM
We have posted this earlier in the week but I think the post has got lost. This problem is costing us quite a bit in bandwidth.

For some unknown reason, running Resin on a Centos server appears to work fine, however when one browses HTML in the web root, we notice that all images / js / css are requested with GET and 200 OK on the first and also all subsequent clicks. Usually, you would get a 304 not modified and your browser would keep a local copy of all files previously downloaded.

The problem affects HTML, php - everything running on the server.

We have another resin server on Windows, same version - also using the Resin web server - this does not have the same problem.

We can not see anything in the conf. file which is drastically different between the two servers.

All we know is that on the Windows server we are getting 304 not modified and images are cached after first download. On the Linux / Centos version, they are not cached in the browser, and as such , every time you click on a web page, all CSS / js / images are re-downloaded.

We don't have another Centos / Resin server here to test on - does anyone else have one running out there that has this same problem?

Could this be a bug with the web server part of Resin?

Again apologies for the re-post, but I have waited over a day now and it seems the post either got lost or for some reason the moderator didn't let it though (why not!?!)

Please help!

JD

emil
09-23-2010, 08:45 PM
Hi JD,

Sounds like an issue with the cache control headers on the images, javascript, etc. If you're using Resin Pro, try checking the <cache-mapping> settings for the appropriate file extensions. Resin's FileServlet should be setting the Etag for all static files (even Resin Open Source), so that shouldn't be happening even if you don't have a long cache control header. Do you see what headers are being sent back with each image/js/css/etc.?

Emil

jdamnation
09-24-2010, 11:33 AM
Hi emil, great to see you back on the forums!

So here are the headers when we go direct to the Resin (via 8080) webserver:

>>>>>>>>>>>>>>

GET /includes/themes/images/bg.jpg HTTP/1.1
Host: www.site.com:8080
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive

HTTP/1.1 200 OK
Server: Resin/4.0.10
Content-Type: image/jpeg; charset=utf-8
Content-Length: 263549
Date: Fri, 24 Sep 2010 11:21:38 GMT

>>>>>>>>>>>>>>

And here are the headers when we go in via the Apache connector - to the very same server / website!

>>>>>>>>>>>>>>

GET /includes/themes/images/bg.jpg HTTP/1.1
Host: www.mysite.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
If-Modified-Since: Tue, 10 Aug 2010 14:47:40 GMT
If-None-Match: "905f9-4057d-36fdbb00"
Cache-Control: max-age=0

HTTP/1.1 304 Not Modified
Date: Fri, 24 Sep 2010 11:25:45 GMT
Server: Apache
Connection: close
Etag: "905f9-4057d-36fdbb00"

>>>>>>>>>>>>>>

You can see that going via the Resin webserver - there are no cache control headers being sent back, there is is no etag, there is no 304 Not Modified, just a 200 - the images are not being cached by the browser!

This is not resin pro - we have set up two Resin servers now and they both behave in this exact same way - the only way we can get round the issue is by using the Apache connector.

But I would really like to know what is causing the issue - surely this can't be an issue that affects all Resin sites on linux?

Any ideas?

JD

emil
09-27-2010, 04:41 PM
Hi JD,

I can't reproduce this -- running Resin 4.0.10 (non-pro), I see both an Etag and a Last-Modified being sent for files. Can you send your configuration?

Emil

jdamnation
09-28-2010, 10:24 AM
Sure - please see attached zip file - it seems like a very simple xml config to me - but perhaps there is something glaringly obvious wrong with it?

More information from further testing - we are calling the Railo application from .war archive :

<web-app id="" root-directory="" archive-path="/usr/local/resin/wars/railo.war"/>

When we remove

archive-path="/usr/local/resin/wars/railo.war"

The issue goes away - obviously this is not a solution!

When we put the archive-path line back in - and call some html (not .cfm) - the issue returns.

When we use the Apache connector - it's fine.

So it seems like some sort of issue with using the resin web server and .war archives?

We are using the apache connector now but I would still like to get the bottom of this as I really would like to use Resins webserver if possible...

JD