Skip to main content

Bug Tracker

Side navigation

#3932 closed bug (wontfix)

Opened January 21, 2009 04:19AM UTC

Closed February 11, 2009 04:38PM UTC

Last modified October 23, 2013 01:18PM UTC

If an AJAX POST request receives a 301 response, data is not re-POSTed to the new location

Reported by: Firehed Owned by:
Priority: minor Milestone: 1.3.2
Component: ajax Version: 1.3.1
Keywords: Cc:
Blocked by: Blocking:
Description

I found this with help from Firebug, and get identical results in Safari as well:

If an AJAX request to a page that receives a "301 Moved Permanently" response, an empty GET request is made to the new location.

I think it's very unlikely that people will come across this, but if you miss a trailing slash on an address for example (when using nice mod_rewrite addresses), this comes up.

Sample:

jQuery.post("ajax", objectId: 'demo', function(ajaxResponse){alert(ajaxResponse);});

Firebug shows a POST request to http://mysite.com/admin/ajax (the page's html contains a <base href="http://mysite.com/admin/" /> tag in the head) with the correct payload.

Response: 301, Location: http://mysite.com/admin/ajax/

(note the trailing slash)

The 301 prompts a GET to the location specified in the above response. The GET has no payload. The expected behavior is that the original POST response would simply re-POST to the new location.

Attachments (0)
Change History (3)

Changed February 03, 2009 03:05AM UTC by dmethvin comment:1

As I understand what happened, it doesn't sound like a bug. The

.ajax()
method did a POST to the requested URL and got an HTTP response of 301. The code that called
.ajax()
can do whatever it wants with that response, including re-posting to the given location.

Changed February 11, 2009 04:38PM UTC by john comment:2

milestone: 1.3.11.3.2
resolution: → wontfix
status: newclosed
version: 1.31.3.1

Yeah, I agree that this is probably something that we won't be able to handle explicitly.

Changed October 23, 2013 01:18PM UTC by anonymous comment:3

I'm so glad I've found this page!!!! Spent hours trying to understand that.

Thanks!