Cache-control header

I have an authenticated webapp with a servlet that send information back to the client browser that is not particularly sensitive. As such, I'd like for the client to be able to cache the retrieved data for a reasonable amount of time.
Thus, I've added the following code to my servlet:
long expireTime = System.currentTimeMillis() + (7 * 24 * 3600 * 1000); // Cache for one week
response.setDateHeader("Expires", expireTime);
response.setHeader("Pragma", "cache");
response.setHeader("Cache-control", "public");While my expires header is indeed getting set to the date that I specify, AS7 is ignoring my Pragma header and sending two (!) Cache-control headers (as seen in a packet dump using ethereal):
Hypertext Transfer Protocol
    HTTP/1.1 200 OK\r\n
    Server: Sun-Java-System-Application-Server/7 2004Q2\r\n
    Date: Sat, 23 Apr 2005 01:30:15 GMT\r\n
    Content-type: message/rfc822\r\n
    Expires: Sat, 30 Apr 2005 01:30:15 GMT\r\n
    Pragma: No-cache\r\n
    Content-disposition: attachment;filename=msg145206-11461.eml\r\n
    Cache-control: no-cache\r\n
    Cache-control: public\r\n
    Transfer-Encoding: chunked\r\n
    \r\n
    HTTP chunked responseAm I doing something wrong, or is this a bug in AS7?
This is really causing a problem, because I want the browser to toss this data stream over to Outlook Express (the data is an e-mail message) but IE sees the no-cache header and refuses to write the file to disk, and thus, OE has no file to open.
Thanks,
Bill

Oh, BTW we believe this header modification is happening because we are setting a cookie and so WLS sees this and adds its own header. Still, we don't want WLS to do anything with the headers.

Similar Messages

  • Firefox is caching my website page even http cache-control header was in use

    Hi
    Http header "Cache-Control: private, no-cache, no-store, must-revalidate" was used but firefox still caching my webpage. authenticated page of website can be viewed by using work offline feature of firefox.
    Please Help
    Thanks
    Prasant Sharma

    https://developer.mozilla.org/en-US/docs/HTTP_Caching_FAQ
    CORS was added to Firefox 29, IIRC. <br />
    https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
    Have you looked into Page Info, specifically the Meta Tags? <br />https://support.mozilla.org/en-US/kb/page-info-window-view-technical-details-about-page

  • Reader X doesn't display Pdf stream if response contains header "Cache-Control: no-store, no-cache"

    Hi all,
    I work on a web application that, among others, generates Pdf documents. It renders them directly within the IE window by "streaming" the content of the Pdf in the response output stream. Note that we also add the header "Cache-Control", "no-store, no-cache, must-revalidate,post-check=0, pre-check=0" to the response.
    Everything was fine with previous version of reader but since I installed Adobe reader X the content of the Pdf is not showing any more in my browser.
    Here is what I already investigated:
    - if I use another machine with an "older" Reader version, it works. If I save the displayed Pdf and try to open it on the machine where X is installed  it works
    - if I remove the the Cache-Control header, then it works with reader X installation
    Do you have any idea what changed between version 9 and X that could lead to this issue ?
    To ease diagnostic I created a sandbox environment to reproduce the problem, you can go to the following address to see what's happening (or not in case you have version X installed)
    With the Cache-Control header: http://readerxissue.appspot.com
    Without the Cache-Control header: http://readerxissue.appspot.com/enableCache.html
    I must confess that I am a bit stuck and I wonder if some of you could help.
    Thanks a lot
    Regards
    Vincent

    Hello,
    We have semiliar problems in sweden with Adobe Reader X 10.1 Swe and Internet Explorer 8.0 with streamed PDF files.
    We had some issues and got them resolved by the following
    Upgraded to Adobe Reader 10.1.2.45 Eng
    - Print Issue:http://helpx.adobe.com/acrobat/kb/pdf-wont-print-reader-10.html
    - Grey box in Internet explorer: http://helpx.adobe.com/acrobat/kb/pdf-opens-grey-screen-browser.html
    - Add site as trusted: Edit-> Preferences, unbox Enable Enhanced Security + add the host/url to site that is whitelisted to send pdf files
    (the Automaticly trust sites from mu Win OS security zones doesnt work for us)
    The thing is we run MUI pack on our Citrix servers and want Adobe Reader in Swe but it havent been translated yet...
    So we have to wait for the swedish release on Adobe Reader X 10.1.2
    Thanks,
    Tony Van Der Haagen
    IT-Mästaren
    Sweden

  • Can't propagate Cache-Control headers with Surrogate-Control header

    My application may set the following response header to cause webcache to process the esi:include's:
    Surrogate-Control: content=ORAESI/9.0.4, max-age=3600
    It and also may set the following intended for the browser cache:
    Cache-Control: private
    or say:
    Cache-Control: max-age=3600
    However Webcache removes this and always adds the following whenever surrogate-control has been set:
    Cache-Control: max-age=0
    This means I can't have browser caching and esi page compilation, just one or the other.
    This seems to be designed behaviour can someone explain why this is and if it can be worked around?
    I realise that the Cache-Control header should be ignored by webcache but why cant I propagate it to higher caches?

    Patrik,
    You'll need to convert the meta http-equiv tags into actual HTTP headers before sending for Web Cache to be able to parse it.

  • Cache control directives in iPlanet 4.1 (SunOS 5.7)

    Using the admin gui (Content Mgmt->Cache Control Directives), I set the cache control to "No Cache" for the entire server; however, clients still seem to cache pages from the server (IE6 on winxp does not go to the server for pages it has seen before). I looked at the response headers using wget on solaris (as well as wfetch on winxp), and I don't see the Cache-Control header. Here is what I get back after requesting a page from the server:
    HTTP/1.1 200 OK
    Server: Netscape-Enterprise/4.1
    Date: Wed, 31 Dec 2003 14:01:13 GMT
    Content-type: text/html
    Content-length: 120
    Connection: keep-alive
    I restarted the server, and the admin gui shows the correct ("No Cache") setting for the server.
    Thanks in advance for any ideas on how to get the server to ask the client not to cache the pages.

    Can you show us your obj.conf file?
    Thanks
    Manish

  • Cache-control on IPlanet 6.0 SP5 doesn't work

    Hi.
    I am desperately trying to set cache-control max-age=0/no-cache to every file that is sent by the IPlanet from a special directory. I used the web console to set /dir/* to no-cache or max-age=0 but althoug the settings are applied and the server is restarted the HTTP header is still not touched in any way.
    I read to changes of SP6 and SP7 but couldn't find anything regarding this problem so I haven't upgraded yet.
    obj.conf says:
    <Object ppath="/var/apps/weblogic/myserver/public_html/mydir/*">
    PathCheck fn="set-cache-control" control="no-cache"
    </Object>
    This is placed directly after the default object.
    Any help is highly appreciated. Thanks a lot,
    Thomas

    There's a big difference between the set-cache-control SAF and the HttpServletResponse.addHeader API. set-cache-control understands the HTTP protocol version in use and, if that version supports Cache-control header fields, adds a Cache-control header. HttpServletResponse.addResponse blindly adds any header you specify.
    If you want to use HttpServletResponse.addHeader to add a Cache-control header to a response in Web Server, you can do so. The meaning of that header isn't defined by the HTTP/1.0 protocol, however.

  • Prolem with Cache-Control:max-age http header

    Hello
    It seems that safari do not take into account Cache-Control:max-age=31536000 http header.
    Sending this header to the browser I would expect that safari will not ask the server for these resources before current date + one year.
    It's the way IE and FireFox are working but safari is asking the server for these resources every time my html page is loaded (see http requests below).
    Server returns a 304 status to indicate that the resource is not modified.
    Does somebody have an idea about this strange behaviour?
    I'm surprise that Safari do not respect RFC specifications.
    Is there a settings to enable Cache-Control ?
    Perhaps I forgot safari's specific headers..
    Thanks
    +GET 786+
    GET /xtend/htmrsrc/LIB/XtendAjaxScripts.js HTTP/1.1
    +RESP 786+
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Last-Modified: Wed, 15 Oct 2008 13:25:24 GMT
    *Cache-Control: PUBLIC, max-age=31536000, must-revalidate*
    *Expires: Thu, 05 Nov 2009 13:09:10 GMT*
    Content-Type: application/x-javascript;utf-8
    Content-Length: 2856
    Date: Wed, 05 Nov 2008 13:09:10 GMT
    +GET 799+
    GET /xtend/htmrsrc/LIB/XtendAjax.js HTTP/1.1
    If-Modified-Since: Fri, 24 Oct 2008 07:59:24 GMT
    +RESP 799+
    HTTP/1.1 304 Not modifed
    Server: Apache-Coyote/1.1
    Date: Wed, 05 Nov 2008 13:11:19 GMT

    This is a User to User forum, not a developer forum. You need to avail yourself of developer resources for this problem instead of posting them here.
    Mulder

  • JRE Cache ignores the "Expire" and "Cache-Control: no-cache" directives.

    My applet is using HttpURLConection to retrieve data from a server with Caching enabled. The cache contents are "revalidated" (via "if-modfied-since") each time the applet is started. However, subsequent requests to retrieve the same resource are always read from the cache with no validation even if the resource has expired.
    The server is sending a valid "Expires:" tag and "Cache-Control: no-cache" tag in the response; but, the JRE refuses to recheck for an updated version of the resource even after the file has expired.
    The JRE does seem to understand the "Cache-Control: no-store" tag; but, this is inefficient (no caching at all) when I'm tring to get it to not refetch the resource unless there's a change. Is there some other tag that the JRE is expecting to see?

    I have a similar problem except that I want my pages to not cache at all. The server is setting the Cache-Control: max-age to 0 and the Expires to "now" but JRE seems to ignore these settings, but only sometimes. Sometimes pages are fetched from cache and sometimes from the server.
    In my applet I'm using a normal URLConnection like this:
    URLConnection uc = new URL("http://<server>/method").openConnection();
    uc.connect();
    InputStream is = uc.getInputStream();
    is.read();When my request headers look like this:
    accept-encoding: gzip
    Host: <server>
    Cache-Control: no-cache
    Pragma: no-cache
    User-Agent: Mozilla/4.0 (Windows XP 5.1) Java/1.6.0_13
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    Connection: keep-alivethe page will not be cached and is requested again but this time without the accept-encoding, Pragma and Cache-Control. The adding (and removal) of the headers seems to happen inside the JRE, though. I'm not explicitly setting them.
    The response header of the first request looks like this:
    HTTP/1.1 200 OK
    Date: Wed, 20 May 2009 12:55:07 GMT
    Server: Apache/2.2.11 (Win32) mod_jk/1.2.26 PHP/5.2.8
    Cache-Control: max-age=0
    Expires: Wed, 20 May 2009 12:55:07 GMT
    Vary: User-Agent,Accept-Encoding
    Content-Encoding: gzip
    Keep-Alive: timeout=120, max=79
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: text/html;charset=iso-8859-1When the request is made with this header:
    User-Agent: Mozilla/4.0 (Windows XP 5.1) Java/1.6.0_13
    Host: <server>
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    Connection: keep-aliveThe response headers looks like this:
    HTTP/1.1 200 OK
    Date: Wed, 20 May 2009 12:55:07 GMT
    Server: Apache/2.2.11 (Win32) mod_jk/1.2.26 PHP/5.2.8
    Content-Length: 1016
    Cache-Control: max-age=0
    Expires: Wed, 20 May 2009 12:55:07 GMT
    Vary: User-Agent,Accept-Encoding
    Keep-Alive: timeout=120, max=83
    Connection: Keep-Alive
    Content-Type: text/html;charset=iso-8859-1And in this case the JRE sometimes fetches the request from the server and sometimes from cache. I have not been able to determine how the JRE decides to refresh, or why it sometimes sends an accept-encoding and Pragma header and sometimes not.
    any help would be appreciated.
    Alex

  • "Content-type: text/html; charset=utf-8 cache-control: no-cache..." display

    "Content-type: text/html; charset=utf-8 cache-control: no-cache, no-store, max-age=0, must-revalidate pragma: no-cache X-Frame-Options: DENY "
    is being displayed at the top of one of our pages now. I can see that line in the body section of the page using Firebug, but can't find what is creating it there.
    Does anyone have any tips on how I would go about finding something like this?
    The page was using a custom theme but that stopped working when we upgraded to 4.1. So, I copied the Simple Green template to start modifying.
    Mentioning that in case it's relevant...
    Thanks!

    LauraC wrote:
    "Content-type: text/html; charset=utf-8 cache-control: no-cache, no-store, max-age=0, must-revalidate pragma: no-cache X-Frame-Options: DENY "Looks like an HTTP header...
    is being displayed at the top of one of our pages now. I can see that line in the body section of the page using Firebug, but can't find what is creating it there.
    Does anyone have any tips on how I would go about finding something like this?If it's included within the <tt>body</tt> element in the original page source then it's produced by something in APEX and the position in the source will give a clue as to where. You should also run the page in Debug mode and look at the trace to see if there's any clues there.
    If it's visible in the generated page source but not the original then it's produced by something dynamic in the page. Possibly some JS lingering from the previous theme?

  • Cache-control, Expires headers

    I want JNLP files and JAR files to be cached by JNLP clients, but I want to prevent them from being cached in a browser / proxy server / ISP server of some sort (anything that would prevent the JNLP client from getting updates).
    To stop a web page being cached I typically use the following:
    response.setDateHeader("Expires", 1L);
    // Set standard HTTP/1.1 no-cache headers.
    response.setHeader(
    "Cache-Control", "no-store, no-cache, must-revalidate");
    // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
    response.addHeader("Cache-Control", "post-check=0, pre-check=0");
    // HTTP 1.0 header
    response.setHeader("Pragma", "no-cache");This works well in stopping caching of web-pages, and it doesn't stop the Sun Java Web Start client (JRE 1.5) from caching JNLP / JAR files (I don't think it's actually checking any of the above headers).
    However, I have read that setting the above headers can cause problems. Does anyone know the official line on this? I couldn't find anything in the JNLP spec.
    If it makes a difference, the app will be deployed only on JRE 1.4 or later.

    LateNightMovies,
    > Hi, thanks for your reply (and sorry for posting my
    question
    > twice)...
    No worries. :)
    > ** unfortunately, your solution doesn't work.
    It's possible I didn't understand what you're after.
    > My objective is to "not have the page stored" (saved) in
    the
    > cache (it contains data I don't want stored in client
    browsers).
    Aha. Nine times out of ten, when people say they want to
    want to avoid
    cacheing, what they mean is, "Get Flash to always ask for new
    data," which
    is what that blog entry describes. If it's important that the
    data not be
    cached at all....
    > Adding a ? var - does ensure the page is always
    retrieved
    > from the server - but it still gets saved in the browser
    cache.
    Right.
    > Eg. my url = page.asp?param=# (random number)
    >
    > The browser cache (Content.IE subdirectories) fill up
    with
    > files = page[1].html, page[2].html, page[3].html,....
    Yup. Well, shoot. This question isn't something I can just
    roll off
    the top of my head, then. :-/ I should think that your HTML
    header would
    take care of that.
    Are you appending the random number in your LoadVars method
    calls? The
    HTML page shouldn't be refreshing at all.
    I know a few people I can ask for futher input, and I'll
    report back to
    this thread.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Cache-Control and Accept-Encoding support in Adobe AIR HTML Component

    I am evaluating Adobe AIR's HTML component and trying to figure out what is supported.
    I built the AIR app and had it point to www.google.com
    I notice that the requests to fetch JS,CSS from Adobe AIR do not include Accept-Encoding: gzip header.
    Does Adobe AIR's HTML Component support Accept-Encoding : gzip header ?
    I also noticed that even though the content served with far futures expiry, i.e. has Cache-Control: maxage={value} subsequent requests are being made and content is not served from the browser's cache.
    I observed this accross the app restarts.
    Can someone please clarify support of the two above Http headers ?
    Thank you.
    -Prashant

    You might also want to check out the useCache property to see if this helps.  See these links:
    http://forums.adobe.com/thread/726573
    http://forums.adobe.com/thread/490497
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/html/HTMLLoader.h tml

  • Controlling Cache-Control headers

    We have an application written in BC4J 9.0.3.4 riding atop 9iAS 9.0.3.1.0.
    The release notes for this version of 9iAS say
    2484551 Microsoft Internet Explorer cannot open some file directories due to HTTP NO-STORE header
    If users use Microsoft Internet Explorer 6.0.2600.0000, then they cannot open some attachments, such as Microsoft PowerPoint or voicemail directly. They have to save the file and open it from their file system. The file cannot be opened because Microsoft Internet Explorer 6.0 doesn't save the file to the <code>temp</code> folder when an HTTP no-store header is set.
    Saying that this is fixed is, to say the least, iffy. A packet dump clearly shows the following headers being set at some point after JSP filters get a chance to kick in (i.e., probably by mod_oc4j itself):
    Pragma: no-cache
    Cache-Control: no-store
    Surrogate-Control: no-store
    Cache-Control: private
    There doesn't seem to be any way of turning these headers off other than using .htaccess and mod_headers to explicitly delete them (which is definitely not ideal). Further, my tests indicate that these headers (probably only Cache-Control: no-store) prevent IE5.5 and IE6 both from launching external applications on the basis of Content-Type / extension, and from saving the page at all.
    This is, admittedly, a violation of RFC2616 on IE's part: that RFC states that no-store is meant to apply to intermediate proxies, not to user agents themselves. But nonetheless I think Oracle should at least allow pandering to this particular bug; i.e., even if Cache-Control: no-store is on by default, it should be possible to turn it off.
    Am I missing something? Is there any way to stop mod_oc4j adding these headers?

    I tried the brute-force approach:
    Header set Cache-Control: no-cache
    Header set Surrogate-Control: no-cache
    in .htaccess.
    Alas, .htaccess isn't being read, even with
    <Directory /oracle/product/ias_903/j2ee/OC4J_DEV/applications>
    AllowOverride FileInfo
    </Directory>
    in the httpd.conf.
    This is confusing. Does mod_oc4j somehow ban the processing of .htaccess files even if the AllowOverride says otherwise?

  • Mozilla Firefox 32.0.1 caching objects without cache control headers

    Mozilla firefox is caching objects without any cache-control or expires header in response. The response does contain etag and date header but doesnt indicate anything about the duration it should be caching it. An example URL is https://www.priceless.com/content/dam/priceless/us/en/newyork/component/backgroundimages/NewYork_1920x596.jpg
    Am I missing something very obvious here.

    That is a beautiful picture. I understand that you are looking for a return header information about expiration. The about:cache page will show that information akaik there is a column information about expiration time. Some expire and some don't. I am pretty sure the later is the case you are seeing.

  • Cache-Control problem

    I don't really know if this is a Tomcat problem or a jsp problem... I have some java server pages with form components and when I hit the back button in a browser, the contents of a form disappear. I checked the response header with a perl script and it seems that there's always Cache-Control: no-cache and Pragma: No-cache in the header. I didn't put them there. I've tried to put some lines as
    response.setHeader("Cache-Control","max-age=3600");
    response.setHeader("Pragma","max-age=3600");
    response.addHeader("Cache-Control","max-age=3600");
    response.addHeader("Pragma","max-age=3600");
    into my jsp, but they have no effect. I've tried disabling all filters, no effect. I've done a full text search on the whole tomcat directory tree with keywords like no-cache, cache-control and those words don't appear anywhere (but in my jsp). I suspected that apache could mess things up, but browsing the jsp's directly from tomcat (through port 8080) does the same.
    Running out of ideas... Do you have any?
    -Marko

    It's neither. It's a browser problem... and perhaps your assumption that the browser has to remember what was in the form fields when you go back. Cache control has to do with caching the page, not form input anyway. I've never seen any header settings which tell instruct a browser what to do with form data after the form is submitted.
    You could provide a back button on the form and have the JSP fill in the default values based on what's stored in the session, if you are storing it in the session. But if it's not a multipage form, there usually is no reason to be "going back" anyway, because the form is submitted and whatever's done with that data should be done by that point.
    Tomcat could be defining default headers for anything in some config file.

  • Cache-Control: no-cache

    I have Web Cache set up with an Apache Server and it is returning requests from the cache. I have a response monitoring tool that sends the HTTP 1.1 Cache-Control: no-cache header on the request but Web Cache still returns from cache rather than getting the page from the server. The only configuration option appears to control honoring of response headers not request headers. Shouldn't Web Cache always honor request headers?

    Hi,
    Yes, it should and will, as far as I have seen, honor request headers too. But, AFAIK, "Cache-Control: no-cache" is a reposne header (as given in HTTP RFC):
    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1
    So, specifying this in the request doesn't have effect.
    Hope this helps.
    Regards,
    Priyanka
    Oracle Web Cache Team

Maybe you are looking for

  • How do i use my account if i don't have a credit card

    i live in a location where credit cards are almost not used except for super rich people and corporations and i need to update my stuff. how is that going to work???

  • New iMac DOA

    Hey apple. Just want to says thanks. I've spent endless dollars on your products over the years. I order a iMac i7 and wait like everybody else for "ships:november". I was scared I might have screen flickering like others but thanks to you, upon unbo

  • RE:simple tree list(oops concept)

    Hi all, In class CL_GUI_LIST_TREE we have a method called add_nodes_and_items>.In that method you are exporting 2 tables ie node_table and  item_table.I want to know how to populate these 2 tables and also what is the purpose for these 2 tables. Plea

  • System.currentTimeMillis() returns time in UTC or not??????

    Hello Friends, I want to know that "System.currentTimeMillis()" returns time in UTC or Current Local time ie suppose i set my TimeZone (GMT+ 2) then statement gives me value in milliseconds by adding 2 hours to the GMT(Is this value should consider a

  • Spring framework ModelAndView question.

    Hi, In my controller object, it creates a ModelAndView object and invoke the following methods: ModelAndView mv = new ModelAndView("hello"); mv.addObject(req); mv.addObject(resp); mv.addObject(ctx); I would like to know how to access these objects (i