node-red / node-red-node-swagger

A set of tools for generating Swagger api documentation based on the HTTP nodes deployed in a flow
Apache License 2.0
63 stars 48 forks source link

/http-api/swagger.json is not CORS enabled #36

Open chameleonbr opened 8 years ago

chameleonbr commented 8 years ago

I have swagger UI on other server and I try to link with my node-red swagger API but CORS headers are not found on /http-api/swagger.json

curl -I http://myhost:1880/http-api/swagger.json
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 921
ETag: W/"399-O+kHybLKLLCZ4lh4LITBaw"
Date: Wed, 20 Jan 2016 19:58:17 GMT
Connection: keep-alive

Placing the configuration:

httpNodeCors: {
        origin: "*",
        methods: "GET,PUT,POST,DELETE"
    },

it still happens

knolleary commented 8 years ago

Thanks for raising. The httpNodeCors configuration only gets applies to the HTTP In nodes - other things don't get it 'for free'. Will need to add in the proper handling for it in this node.

tonykambo commented 7 years ago

It doesn't look like CORS support has been added yet. This would greatly be appreciated.

(Allowing external access to the swagger UI tab instead would be even better! Should I raise that asa feature request or is it unlikely to be implemented?)