Fetch fails only when sent from Wix

I’m doing a Fetch/POST to a login page of a 3rd party website.

The code is fairly simple.

let form = new FormData();
form.append( ‘username’ , myUsername);
form.append( ‘password’ , myPassword);

var headers = { ‘method’ : ‘post’ ,
‘body’ : form,
‘credentials’ : ‘include’ }

fetch( LoginURL, headers)
.then( loginResponse => { console.log( loginResponse ); })
. catch ( loginError => { console.log( “failed connection” ); })

I can monitor the loginResponse (cookies) to determine if the login was successful or not.

I first tested this code using the Chrome Browser Developer console, testing with both a correct and incorrect password being sent.

Incorrect Password → Returned with ‘Not Logged In’
Correct Password → Returned with ‘Login Success’

Then I did the same thing from the Wix backend developer test (Or testing with live site)

Incorrect Password → Returned with ‘Not Logged In’
Correct Password → WebMethod Request Timed Out

The connection typically takes about 1 second. It is not an actual time out, but rather seems that something is being rejected.

It doesn’t seem like this is the fault of the 3rd party site, since I can test with different origins with success. Only testing from Wix does it fail. Any ideas?

Partly answering my own question…

When the login fails, the response type is a plain fetch.
When the login is successful, the response type becomes fetch/redirect .

The Browser Console seems to be handling the redirect for me. Wix/Backend seems to not handle a redirect? The response never comes in, and the promise is left unfulfilled.

Adding this to my headers fixed the issue:
‘redirect’ : ‘manual’

However, if somebody has more insight or knowledge as to what’s going on it would be appreciated.