Skip to main content

Bug Tracker

Side navigation

#9472 closed bug (invalid)

Opened May 31, 2011 10:07PM UTC

Closed July 14, 2011 07:44AM UTC

Last modified March 09, 2012 06:20AM UTC

$.ajax: X-Requested-With header gets lost....request send twice?!

Reported by: martin.keckeis1@gmail.com Owned by: martin.keckeis1@gmail.com
Priority: low Milestone: 1.next
Component: ajax Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

Hello,

i've run into a problem which drives me really crazy.

After 4 hours checking / searching i don't know where i can search for this problem anymore...

I would be really happy, if someone can help me further soon!

SOMETIMES!, so not every request, the request seems to be send twice, But it's not really send twice?!!

  • Firebug show the request twice (but the first one not completed), in the first one the X-Request-With Header would be set
FIRST request header:
GET http://lisp/auth/userFavorite/list
Host	lisp
User-Agent	Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 FirePHP/0.5
Accept	application/json, text/javascript, */*; q=0.01
Accept-Language	de-DE,de,en-US;q=0.9,en;q=0.9,de-formal;q=0.8,en-gb;q=0.8,en-ca;q=0.8,en-EN;q=0.7,de-AT;q=0.7,fr-FR;q=0.6,fr;q=0.6,he-IL;q=0.6,he;q=0.5,pt-PT;q=0.5,pt;q=0.4,ru-RU;q=0.4,ru;q=0.4,es-ES;q=0.3,es;q=0.3,nl-NL;q=0.2,nl;q=0.2,de-CH;q=0.2,de;q=0.1,en-us;q=0.1,en;q=0.0
Accept-Encoding	gzip, deflate
Accept-Charset	ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive	115
Connection	keep-alive
X-Requested-With	XMLHttpRequest
Referer	http://lisp/auth/index/startpage
Cookie	LISP=uqebnqnga8vs1kl32cnuvingi7; ZDEDebuggerPresent=php,phtml,php3
x-insight	activate
SECOND request header:
GET http://lisp/auth/userFavorite/list
Host	lisp
User-Agent	Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 FirePHP/0.5
Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language	de-DE,de,en-US;q=0.9,en;q=0.9,de-formal;q=0.8,en-gb;q=0.8,en-ca;q=0.8,en-EN;q=0.7,de-AT;q=0.7,fr-FR;q=0.6,fr;q=0.6,he-IL;q=0.6,he;q=0.5,pt-PT;q=0.5,pt;q=0.4,ru-RU;q=0.4,ru;q=0.4,es-ES;q=0.3,es;q=0.3,nl-NL;q=0.2,nl;q=0.2,de-CH;q=0.2,de;q=0.1,en-us;q=0.1,en;q=0.0
Accept-Encoding	gzip, deflate
Accept-Charset	ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive	115
Connection	keep-alive
Referer	http://lisp/auth/index/startpage
Cookie	LISP=uqebnqnga8vs1kl32cnuvingi7; ZDEDebuggerPresent=php,phtml,php3
x-insight	activate
  • in Live HTTP headers i cannot see that the first one goes out or even get a response.
----------------------------------------------------------
http://lisp/auth/userFavorite/list

GET /auth/userFavorite/list HTTP/1.1
Host: lisp
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 FirePHP/0.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-DE,de,en-US;q=0.9,en;q=0.9,de-formal;q=0.8,en-gb;q=0.8,en-ca;q=0.8,en-EN;q=0.7,de-AT;q=0.7,fr-FR;q=0.6,fr;q=0.6,he-IL;q=0.6,he;q=0.5,pt-PT;q=0.5,pt;q=0.4,ru-RU;q=0.4,ru;q=0.4,es-ES;q=0.3,es;q=0.3,nl-NL;q=0.2,nl;q=0.2,de-CH;q=0.2,de;q=0.1,en-us;q=0.1,en;q=0.0
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://lisp/auth/index/startpage
Cookie: LISP=uqebnqnga8vs1kl32cnuvingi7; ZDEDebuggerPresent=php,phtml,php3
x-insight: activate

HTTP/1.1 200 OK
Date: Tue, 31 May 2011 20:41:01 GMT
Server: Apache
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
----------------------------------------------------------
  • The Apache Log shows only one request (the second one, but also no redirect or anything else, otherwise i should see that in Live HTTP headers)
  • because i run into an error without this header in my custom PHP error log i see also the second one

Further i thougth that i could log both request in a local JS variable, but that even doesn't work:

var requestsLog = new Array();
requestsLog[requestsLog.length] = $.ajax({
url : loadUrl,
				type : ajaxMode,
				data : this.formData,
				dataType : 'json',

				headers: {
					'X-Requested-With': 'XMLHttpRequest'
				},

....

});

I also see only the second request. As you might have seen above, i'm also trying to forcing the header "X-Request-With".

So the header should always get send.

_______________________

Some more information about this problem:

  • the webserver stands in austria
  • the problem first time occured when accessing the service from america (accessing over the intranet)
  • downgrading vo 1.5.2 also didn't helped, the error then goes further -> because i run into an error and for me in PHP is a normal request i send the plain error HTML page and afterwards all Javascript files are loaded again with an XMLHttpRequest?!?
  • JSlins also didn't show errors in my code
Attachments (0)
Change History (8)

Changed May 31, 2011 10:42PM UTC by martin.keckeis1@gmail.com comment:1

Maybe i have also to mention that this also happens in IE8 (not only Firefox)

Changed June 10, 2011 07:26PM UTC by anonymous comment:2

I have the same problem

Changed June 29, 2011 06:55PM UTC by timmywil comment:3

component: unfiledajax
owner: → martin.keckeis1@gmail.com
priority: undecidedlow
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case on http://jsfiddle.net or a simplified test case on your own server that reproduces the issue experienced to help us assess your ticket.

Additionally, test against the jQuery (edge)/jQuery git version to ensure the issue still exists.

Changed June 29, 2011 09:41PM UTC by riageek+jquery@gmail.com comment:4

I am also running into this issue.

It is very intermittent and does not occur with any regular frequency.

The symptoms are exactly like the ops. A seemingly hanging request with what appears (to FireBug) to be two requests made however the server only actually sees one.

Changed June 29, 2011 10:40PM UTC by tedi17 comment:5

To reproduce:

1. click the link below

2. keep the page opened

3. watch firebug console

4. click the button sometimes a couple of times

http://jsfiddle.net/eFYrB/

"It is very intermittent and does not occur with any regular frequency".

Changed July 14, 2011 07:44AM UTC by trac-o-bot comment:6

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Changed August 31, 2011 03:28AM UTC by anonymous comment:7

This is still an issue as far as I can tell and should be investigated.

Changed October 13, 2011 10:28AM UTC by anonymous comment:8

I've also been bitten by this bug, but after putting in a "beforeSend" logging call and also looking at the firebug output and jquery code I don't think this is a jquery bug. So I've looked at firefox bugs that could cause this and from this bug report, https://bugzilla.mozilla.org/show_bug.cgi?id=669759, it seems to be a combination of two things:

1) There is a bug in firefox that means that if an xhr gets redirected then the custom headers are lost (I believe this bug has been recently fixed so maybe in due course it'll stop happening in newer firefox versions)

2) When "automatic proxy detection" is operating firefox will sometimes do an *internal* redirect which triggers the problem in 1)

Of course it's possible that it's not down to that bug, but that seems a likely explanation.