I understand that, but since you build your requests dynamically we should start with finding a difference between each shot, in case these requests are entirely identical you need to contact the service you run requests to
to copy a request as a cURL you need to open the browser dev tool, select the Network tab and using the context menu copy these cUrl and put them somewhere in a text editor for comparison
I also figured out that all the calls fail, but a CORS browser extension I am running was allowing the second call to process. When I disabled it all the calls fail.
I created a Cloud code copy of the exact code (slight modifications to var names) and it runs fine. So the issue is coming from the API call from the browser, which is what I understand CORS to be, a browser policy.
I don’t understand why you’re suggesting I need to contact the service the requests are sent to.
CORS error comes from the browser because this request goes to a different domain, and before sending an actual GET request it sends an OPTIONS request to verify if the external service is able to process a request from another domain, if so it should return a corresponding header. but the external server seems like doesn’t allow requests from another domain.
I understand that in concept. In testing, the calls are coming from a test backendless domain (magicaljelly), however, In production, the requests are both from subdomains of our main domain.
contact the service community to find out why it fails with CORS, perhaps there is a need to add your backendless domain to a white list on the service
create an API Service and use it as a proxy and call the API service from the UIBuilder app
How would I know if it is failing on the OPTIONS request?
contact the service community to find out why it fails with CORS, perhaps there is a need to add your backendless domain to a white list on the service
It is an API running on our server. The server has no issue with API calls from Cloud code. What I want to understand is why is there a difference between Cloud code calls and browser calls?
2. create an API Service and use it as a proxy and call the API service from the UIBuilder app
I’ve done this already as a test. It adds 500-700 ms to the load time, which I’d like to avoid.
When a page is loaded by the browser from host X and the same page makes a request going to host Y, the browser imposes a CORS policy by issuing the OPTIONS request to ensure the subsequent (actual API) request can go through. This does not happen when the same request is executed from the server-side environment.