caching with static xml, xsl and jss files

We have static xml, xsl and jss files deployed on the sun one webserver 6.1 SP3. We want it to be cached on the browser ( we are using IE 6 ) to better our performance, which is not happening. Browser is caching all except this three types of files. has anybody encountered the same problem then please help me. Please help me with the following questions.

1. How to stop server setting and sending E-tag in response http header?

2. How to stop server setting and sending pragma: no-cache in response http header?

Sunil Parmar

http://sunilparmar.com

[581 byte] By [sunilosunil] at [2007-11-26 10:03:35]
# 1

Sunil, I don't understand why you'd want to stop the server from sending the Etag header. The presence of the Etag header actually aids in caching. If you remove the Etag header, browsers will be less likely to cache the response.

As for Pragma: no-cache, the server won't send this by default. If you're seeing Pragma: no-cache, it means the server has been manually configured to send Pragma: no-cache. Can you share the details of your deployment?

elving at 2007-7-7 1:37:37 > top of Java-index,Web & Directory Servers,Web Servers...
# 2

I want to stop server from sending Etag to force the broswer to check "if modified" header, which is probably being ignored in presence of Etag.

Details of the deployment is pretty huge and will be time consuming. Can I get any help on which parameters may cause setting pragma: no-cache ?

sunilosunil at 2007-7-7 1:37:37 > top of Java-index,Web & Directory Servers,Web Servers...
# 3

You're better off with ETag.

As for Pragma: no-cache, because Web Server is programmatically extensible, there are an all but infinite number of ways to cause Web Server to emit that header. Any Servlet, JSP, or NSAPI plugin could choose to add a Pragma: no-cache header. Web Server itself only ever adds its own Pragma: no-cache header field to form auth pages. (Form auth is a way of protecting access to Java web apps. It's enabled by the web app's web.xml descriptor. The header field is only added to the form auth pages themselves, so that doesn't sound like your problem.)

Are you sure Web Server is emiting a Pragma: no-cache header field? Can you share the HTTP response that includes a Pragma: no-cache header field?

For example, here is what a normal request and response for an XML file look like:

GET /foo.xml HTTP/1.1

Host: foo

HTTP/1.1 200 OK

Server: Sun-Java-System-Web-Server/7.0

Date: Tue, 19 Sep 2006 00:56:36 GMT

Content-type: text/xml

Last-modified: Tue, 19 Sep 2006 00:56:05 GMT

Content-length: 48

Etag: "30-450f4025"

Accept-ranges: bytes

<?xml version="1.0" encoding="UTF-8"?>

<foo />

Note that there is no Pragma: no-cache header field.

elving at 2007-7-7 1:37:37 > top of Java-index,Web & Directory Servers,Web Servers...
# 4

Hi elving,

I am a colleague of Sunil and am trying to assist with this issue.

I think the main issue encountered here is the following:

Irrespective of etag or caching headers, is there any way to force/ensure .xml .xsl and .jss are being cached on the client side by Internet Explorer? These are the only three file types we are finding do not get cached by the browser.

From our tests this does not appear to be the default behaviour. It could be due to IE sending a no-cache header, but perhaps you could shed some light?

Here is an example request header listing:

GET /gi_hub/JSX/js/resourcelist.xml HTTP/1.1

Accept: */*

Referer: http://my.host.com/gi_hub/UTiDeploy.jsp?p_user_cd=abcdef&p_mail=abc@def.com

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

Host: my.host.com

Proxy-Connection: Keep-Alive

Pragma: no-cache

Cookie: JSESSIONID=B5DCF2E8E0C11C0E2E400B6BA21B70C4; EXE_USER=abcdef

Authorization: Basic dkfjldjflskdjflskdjfklsdkjfjl

And the server response:

HTTP/1.1 200 OK

Server: Sun-ONE-Web-Server/6.1

Date: Wed, 20 Sep 2006 15:20:50 GMT

Content-type: text/xml

Last-modified: Fri, 21 Apr 2006 12:52:30 GMT

Etag: "399-4448d58e"

Accept-ranges: bytes

Content-encoding: gzip

Vary: accept-encoding

Transfer-encoding: chunked

Thanks

kingshaun at 2007-7-7 1:37:37 > top of Java-index,Web & Directory Servers,Web Servers...
# 5

Sorry, I don't know why MSIE isn't caching your response, nor why the request includes Pragma: no-cache.

Why is there a Proxy-Connection header field in the request? Are you using a proxy? Have you checked the response that the proxy returns to MSIE?

(I see that the content has Vary: accept-encoding, indicating that it was dynamically compressed. Such responses used to prevent caching in older versions of MSIE, but I believe those issues were addressed as of MSIE 5.5.)

elving at 2007-7-7 1:37:37 > top of Java-index,Web & Directory Servers,Web Servers...
# 6
Elving,We have come to notice that XML, XSL and JSS files does not get cached with IE 6.0.29 version, but they get cached with 6.0.28 version.ThanksRaju
rajukapalli at 2007-7-7 1:37:37 > top of Java-index,Web & Directory Servers,Web Servers...
# 7
Any thoughts on why XML, JSS files are not getting cached?.
rajukapalli at 2007-7-7 1:37:37 > top of Java-index,Web & Directory Servers,Web Servers...