Running into CORS issue while making API calls from within javascript block in mobile


I've been trying to make a PUT API request to an AWS S3 presigned url from an outsystems mobile app from within the javascript block. I have been getting an HTTP response code 0 and on further debugging I have come to believe it might be a CORS issue. I tested by doing a GET request to and it worked fine. 

I am trying to avoid using the outsytems REST API integration (which works ) as I need to calculate binary data size to set the content-length header and the binarydata API call to calculate the binary data size has sometimes been failing (probably due to our corporate network). So, i want to get my file, calculate the blob size and send it within the javacript itself. Is it possible?

I'd really appreciate any help either with dealing with the CORS issue or calculating outsystems binary data size locally.

Hi Ankit,

I have no solution for your specific problem, but there are a few things I need to mention. For one, I don't understand how calculating binary data size can be caused by "corporate network" problems. Secondly, you need to understand that accessing a REST service through JavaScript on mobile makes a direct connection between the mobile device and the REST service, while accessing a REST service through the Platform will make a connection between the mobile device and the front-end server, then via the front-end server to the REST service.

I had faced same issue in past for web application but not sure how I resolved that.

Please have a look at these posts.