Page 1 of 1

Trouble accessing data after exporting and running on ISS server

Posted: Wed Jun 12, 2013 8:19 pm
by Alvaro Peralta

I'm using RESTful API for my Appery project everything works fine through the preview. However, when I export it and try running it on localhost through ISS express, I am not able to see the data, which is held in collapsible boxes. But creating items updates the data on the API so I am very confused. I also tried the .apk version and that worked fine.


Trouble accessing data after exporting and running on ISS server

Posted: Wed Jun 12, 2013 9:05 pm
by Maryna Brodina

Hello! Looks like there is some problem with allow-cross-origin. Please check console (Network tab).


Trouble accessing data after exporting and running on ISS server

Posted: Thu Jun 13, 2013 12:41 pm
by Alvaro Peralta

Hi, thanks for the reply. That does seem to be the problem. Do you have any suggestions on how to fix it? Thanks.


Trouble accessing data after exporting and running on ISS server

Posted: Thu Jun 13, 2013 12:57 pm
by Kateryna Grynko

Hi Alvaro,

What do you see in browser console?


Trouble accessing data after exporting and running on ISS server

Posted: Thu Jun 13, 2013 1:07 pm
by Alvaro Peralta

Here's what I see: "XMLHttpRequest cannot load http://www.ndwebserver.com/PHPAPI/sim.... Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin. "

I tried searching on Google but I can't seem to make any of the solutions work.


Trouble accessing data after exporting and running on ISS server

Posted: Thu Jun 13, 2013 1:28 pm
by Kateryna Grynko

Trouble accessing data after exporting and running on ISS server

Posted: Thu Jun 13, 2013 3:22 pm
by Alvaro Peralta

Thank your for the link. I'm just confused about whether the fix should be done in the API, browser, Appery, or server level. I apologize, I don't have much experience on this topic.


Trouble accessing data after exporting and running on ISS server

Posted: Thu Jun 13, 2013 6:11 pm
by Maryna Brodina

Hello! On server add in response the following headers:

Access-Control-Allow-Methods - lists all the allowed methods
Access-Control-Allow-Origin - site address
So that headers will look like this for example

Access-Control-Allow-Origin: http://localhost:8080
Access-Control-Allow-Methods: POST, GET, OPTIONS
or like this

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS

or (assuming you're just testing) start chrome with the --disable-web-security flag