How to get the redirect URI from a 303 error

1.1k Views Asked by At

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);
0

There are 0 best solutions below