Server connect actions from different projects and CORS

OS info

  • Operating System : Windows 10.0.18363
  • Wappler Version : 3.3.2

Problem description

Failed to load resource. Server Connect in Desktop app that's connecting to Data API (Server project) is not returning data. If I go directly to the URL for the API in the browser (e.g. http://localhost:8100/api/getUser) I can see the data.

Steps to reproduce

Guesing this is a CORS issue? I do not recall this being mentioned in the documentation that walks through setting this up (Data API project and Desktop app project).

Yes that is a CORS issue.

If you are going to access a server connect actions from a different project or mobile app you need to enable CORS in the global settings of the server connect in the project where the server connect actions are in.

Just enter * as Cors origin options there.

Thanks George.

For others.

  1. click the sprocket.
    image
  2. add origin (Use an astrerick for all domains.)

    NOTE: using * is probably a security risk and not recommended
2 Likes