setRequestHeader does not overwrite default value of Cache-Control: no-cache on post requests




11 years ago
8 years ago


(Reporter: ru.eriksen, Unassigned)


2.0 Branch
Windows Vista

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [CLOSEME 2010-07-30])



11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; da; rv: Gecko/20080201 Firefox/
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; da; rv: Gecko/20080201 Firefox/

Trying to cache a POST response from an XMLHttpRequest, but can not overwrite default value of Cache-Control: no-cache. The same is true for Pragma: no-cache.
It ends up something like Cache-Control: erik, no-cache
This is only true for POST _not_ for GET.

I have deactivated all of my extensions except firebug. 

var httpRequest = new XMLHttpRequest();'POST', 'search/cards', true);
httpRequest.setRequestHeader('Cache-Control', erik');

Here are some samples of the request and the response headers from Firebug:

Response Headers
Date	Sat, 16 Feb 2008 00:31:12 GMT
Server	Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.4
X-Powered-By	PHP/5.2.4
Expires	Sun, 17 Feb 2008 00:31:13 GMT
Cache-Control	max-age=86400
Content-Length	6463
Keep-Alive	timeout=5, max=98
Connection	Keep-Alive
Content-Type	text/html

Request Headers
Host	localhost
User-Agent	Mozilla/5.0 (Windows; U; Windows NT 6.0; da; rv: Gecko/20080201 Firefox/
Accept	text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language	da,en-us;q=0.7,en;q=0.3
Accept-Encoding	gzip,deflate
Accept-Charset	ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive	300
Connection	keep-alive
Content-Type	application/x-www-form-urlencoded
X-Requested-With	XMLHttpRequest
Cache-Control	erik, no-cache
Referer	http://localhost/magic/
Content-Length	62
Cookie	displayStyle=list; PHPSESSID=f5aaddfd801a58250209b204b9caac53
Pragma	no-cache

Reproducible: Always

Steps to Reproduce:
> httpRequest.setRequestHeader('Cache-Control', erik');
> Cache-Control    erik, no-cache

XMLHttpRequest SPEC says;
> setRequestHeader(header, value), method
>   The setRequestHeader() method appends a value if the HTTP header given
>   as argument is already part of the list of request headers.

Sorry but I couldn't find method to remove (a) a HTTP header from list of request headers, or (b) some values from a HTTP header in the list of request headers.
This bug was originally reported on Firefox 2.x or older, which is no longer supported and will not be receiving any more updates. I strongly suggest that you update to Firefox 3.6.6 or later, update your plugins (flash, adobe, etc.), and retest in a new profile. If you still see the issue with the updated Firefox, please post here. Otherwise, please close as RESOLVED > WORKSFORME
Whiteboard: [CLOSEME 2010-07-30]
Version: unspecified → 2.0 Branch
No reply, INCOMPLETE. Please retest with Firefox 3.6.8 or later and a new profile ( If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.