Alvaro Peralta
Posts: 0
Joined: Wed Jun 12, 2013 8:19 pm

Trouble accessing data after exporting and running on ISS server

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.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Trouble accessing data after exporting and running on ISS server

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

Alvaro Peralta
Posts: 0
Joined: Wed Jun 12, 2013 8:19 pm

Trouble accessing data after exporting and running on ISS server

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Trouble accessing data after exporting and running on ISS server

Hi Alvaro,

What do you see in browser console?

Alvaro Peralta
Posts: 0
Joined: Wed Jun 12, 2013 8:19 pm

Trouble accessing data after exporting and running on ISS server

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.

Alvaro Peralta
Posts: 0
Joined: Wed Jun 12, 2013 8:19 pm

Trouble accessing data after exporting and running on ISS server

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.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Trouble accessing data after exporting and running on ISS server

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

Return to “Issues”