PDA

View Full Version : Resin 4.0.10: CSS files not served correctly to Firefox 3.6


rabbitism
10-13-2010, 02:53 PM
This issue just came up and it happens only in Firefox 3.6, but not in IE/Chrome/Safari.

I made a fresh install of resin with no changes to configuration files, and put all my html/js/css files in a webapp. When viewed in Firefox 3.6, the CSS files do not get loaded. I double checked the paths and they are absolutely correct. I believe there is issue with FileServlet along the line of mime-types or encoding that Firefox 3.6 is very particular about.

I take the same set of files and served them with Apache, it comes up fine.

Next, I tried to open up the files in FireFox 3.6 using File Open and that is fine.

Only when it is served up by resin that FireFox 3.6 considers it invalid content.

ferg
10-13-2010, 04:55 PM
To debug this, you can change the level="finer" in the resin.xml <logger>. That will show the headers that Resin is sending back to the browser, and would also show any errors in loading the CSS.

If those headers show incorrect behavior by Resin, it would be helpful to see the problem header logs.

rabbitism
10-13-2010, 05:53 PM
10-10-13 13:51:59.998] {http://*:8443-5} Dispatch '/2/c/site.css' to AccessLogFilterChain[http://localhost, next=CacheFilterChain[null?null, next=WebAppFilterChain[http://localhost, next=com.caucho.server.rewrite.MatchFilterChain@14 5d424]]]
[10-10-13 13:52:00.000] {http://*:8443-5} Http[5] HTTP/1.1 304 Not Modified
[10-10-13 13:52:00.000] {http://*:8443-1} TcpSocketLink[id=1,] starting connection TcpSocketLink[id=http://*:8443-1,http://*:8443,ACCEPT], total=5
[10-10-13 13:52:00.000] {http://*:8443-5} Http[5] ETag: "BMvQK00auwR"
[10-10-13 13:52:00.000] {http://*:8443-5} Http[5] Cache-Control: max-age=60
[10-10-13 13:52:00.001] {http://*:8443-5} Http[5] finish/keepalive
[10-10-13 13:52:00.013] {http://*:8443-1} Http[1] GET /2/j/site.js HTTP/1.1
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] Remote-IP: 0:0:0:0:0:0:0:1%0:53110
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] Host: localhost:8443
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] Accept: */*
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] Accept-Language: en-us,en;q=0.5
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] Accept-Encoding: gzip,deflate
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] Keep-Alive: 115
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] Connection: keep-alive
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] Referer: https://localhost:8443/v2.html
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] If-Modified-Since: Wed, 13 Oct 2010 14:35:45 GMT
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] If-None-Match: "/VwLD/5uCnz"
[10-10-13 13:52:00.014] {http://*:8443-1} Http[1] Cache-Control: max-age=0

rabbitism
10-13-2010, 06:02 PM
I just did this really simple test and the stylesheet is not loading.

test.html

<html>
<head>
<link rel="stylesheet" type="text/css" href="test.css" media="screen" />
</head>
<body>
this should have blue background
</body>
</html>

test.css

body {
background-color: blue;
}


By going to http://localhost/test.html, I should see a page with bluebackground.

If I hit the css directly http://localhost/test.css, I see the content fine.

This is only happening in FireFox 3.6

rabbitism
10-13-2010, 06:07 PM
Screen shots.

27
28

markom
10-14-2010, 09:20 AM
is it so, that server doesnt send content type?

Content-type: text/css; charset=UTF-8

I had this problem on php app some time back when i generated css and javascript dynamically. It was a problem with firefox only.

rabbitism
10-14-2010, 01:20 PM
I've been googling on Firefox 3.6 CSS particularity, but not fruitful.

I cannot do any testing on FF because no stylesheet would load. I tried switching my editor to ISO standard encoding. Next I tried using VI to write the CSS file.

It doesn't explain why when using File/Open on an html, the CSS would then load. Serving up with Apache works as well.

So right, my guess is all Resin is the culprit.

mxwoz
10-16-2010, 05:02 AM
i had this problem when serving from a mac. Resin doesn't encode the CSS file in a way that Firefox likes. Instead its passing it as MAC-ROMAN which firefox thinks isn't valid

I added <jvm-arg>-Dfile.encoding=UTF-8</jvm-arg> to the jvm area and this fixed the issue.

rabbitism
10-18-2010, 01:17 PM
Thank you!!!

I should have disclosed I am on a Mac.

That worked beautifully.