1

I'm sending a dojo xhrPost request to a server I can't control, which gives me a 303 redirect as response. The problem is, the server redirect URI is wrong (going through some reverse proxy or bug and changing it) and leads to an error.

I want to fetch the 303 redirect URI, parse it and do a GET Request with the correct URL. The problem is, I only get the error from my xhrPost and can't get the redirect URL from it. Any way to do this?

Example code:

      var xhrArgs = {
        url: "https://sometestdomain.com/",
        postData: formData,
        handleAs: "json",
        headers: {
          'Authorization': 'Basic 321123123something2313123'
        load: function (data) {
          console.log(data);
        },
        error: function (error) {
          console.log(error);
        },
        handle: function (error, ioargs) {
          console.log(ioargs);
          console.log(error);
        }
      }
      var test = dojo.xhrPost(xhrArgs);
Hans
  • 29
  • 7
  • 1
    See the answer at https://stackoverflow.com/questions/35532531/is-it-possible-to-get-page-redirect-information-via-ajax/35570850#35570850 – sideshowbarker Mar 09 '18 at 22:20
  • I know this answer. It works because the redirect points to a correct URL and you get a 200 status code. As mentioned above my problem is, I get an error from the redirect URL and therefore can't use this code. I want to get the redirect URL from a 404 status code. – Hans Apr 03 '18 at 12:06

0 Answers0