Bug Tracker

Opened 14 years ago

Closed 14 years ago

Last modified 9 years ago

#3932 closed bug (wontfix)

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:


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.


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.

Change History (3)

comment:1 Changed 14 years ago by dmethvin

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.

comment:2 Changed 14 years ago by john

Resolution: wontfix
Status: newclosed

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

comment:3 Changed 9 years ago by anonymous

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


Note: See TracTickets for help on using tickets.