My testing to your backend is done using a HTML 5 test harness making a REST call to a NodeJS script. I’m having issue with getting a 0 return status, which typically indicates cross site issues. If you can set the value of “Access-Control-Allow-Origin” at your end, this should allow it to work. Not sure if I also need “Access-Control-Max-Age” and several other too.
Is this something I can control, or you can enable?
But aren’t these headers only applicable on an “OPTIONS” method request, not POST or GET etc? I wouldn’t be able to get access to the OPTIONS request, that would be intercepted by your web server right?
It would be helpful if you could show what requests go out, to what URL, what headers are sent and what you get back.
Any CORS request starts with a pre-flight request which is OPTIONS. That request is sort of a handshake between the client and the server. All of the CORS headers are established there.
We would need to see more details to be able to help you.
I have a nodeJS web server that I built to test while I wasn’t connected to backendless. It simulates all the scripts and db that I need, and it also handles the OPTIONS request prior to POST. I can’t get the outgoing info, the language I use (Monkey-X) doesn’t allow me to see that. But I have included the input to my NodeJS web server.
This is the OPTIONS pre-request. Below is the actual request with the additional headers I set in my webserver. Note: this is debugging from WebStorm.
You previously wrote you’re getting “0 return status”. In the messages you posted I see the return status is 200, which is what’s expected. I do not see anything wrong with the messages, but the data is still not formatted quite right.
This is the response from my personal NodeJS web server, not backendless. I cannot get this level of data from backendless, as my programming language doesn’t offer it to me. All I can see is status code of 0, and response message of blank.
Try putting a debug proxy server between your machine and Backendless to capture the network traffic. There are several available, for example Charles Proxy. Without that data, there is very little we can do to help.
My webserver (apache) log shows that it is doing an OPTIONS request for *, and it gets back 200 with no message. However, my code receives 0 status code. I’ll have to do some more digging.
The OPTIONS request is not supposed to return any body (this is what I believe you call “message”). It only returns the mentioned headers and 200 response code.
As Mark mentioned above, Charles Proxy could help you debug the requests and responses.
I will take a look at the proxy. It’s strange that everything works perfectly with my simple nodeJS web server. I’m executing the same JS scripts as I have deployed to your server. Either, something is different in the way the OPTIONS is being treated. Or, there’s an error in my script that is not apparently when I run it locally (probably because I’m simulating the Data Store). I did notice when I tried to call OPTIONS directly with a test harness app (PAW), I got a 400 error. This could indicate a bug in script when running in your service. I’ll keep digging.