NodeMC / CORE

Core of NodeMC, including stock dashboard and setup files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CORS prevents using the API via Web.

danielsteiner opened this issue · comments

Hi there, I've been trying to access the API from my own Dashboard which is a bit more complex than the one shipped with NodeMC-CORE and thus not compatible to the njs server.
When accessing the API from port 80 (web) you'll get an error (because of CORS) - this can be prevented by using the CORS plugin which is pretty nice, and can be secured as well - you might consider this.

I've (for now) implemented https://github.com/expressjs/cors in the script (3 line changes) and it's working like a charm.

I will take a look into this, feel free to create a pull request!