In an AJAX call, 302 is not followed

后端 未结 4 2131
孤独总比滥情好
孤独总比滥情好 2020-12-28 15:23

I\'m using jQuery 1.6.2 to make a POST AJAX request to a page on the same domain. That page does a 302 redirect to another page.

Now, on my local machine this work f

4条回答
  •  再見小時候
    2020-12-28 16:14

    I consider this to be a server-side issue, and not client-side. The browser is correct not to follow redirections to http when it makes ajax request by https, as that would be a security flaw.

    I realized I was using relative paths, such as HttpResponseRedirect('/path/to/'). On some layer, that url was prepended with the http:// prefix and that was what the browser received: http://example.com/path/to/

    You must ensure that the Location gets sent in the response header with a full path, including the https://.

提交回复
热议问题