drobbins / TumorBoardServer

Tumor Board Server
0 stars 0 forks source link

CORS not enabled for for Baucis routes? #3

Closed drobbins closed 10 years ago

drobbins commented 10 years ago

Reported by @agrueneberg.

drobbins commented 10 years ago

After a little digging, I'm not sure I fully understand the issue.

curl -I -H "Origin: example.com" https://hydrogen.path.uab.edu/tb/api/v1/patients

HTTP/1.1 404 Not Found
Server: nginx/1.4.2
Date: Mon, 23 Sep 2013 19:22:14 GMT
Content-Type: text/plain
Content-Length: 9
Connection: keep-alive
X-Powered-By: Express
Access-Control-Allow-Origin: *
Allow: HEAD,GET,POST,PUT,DEL
Accept: application/json

From this listing:

  1. I'm not sure why it's a 404 instead of a 200 with an empty JSON array for the body.
  2. The CORS headers seem to coming through
agrueneberg commented 10 years ago

Sorry, it's Angular being stupid. This should do it:

app.use corser.create
    requestHeaders:  corser.simpleRequestHeaders.concat ["X-Requested-With"]
    methods: corser.simpleMethods.concat ["PUT", "DELETE"]
drobbins commented 10 years ago

Fixed in 275c10add387d464429a4e2f10275a576862ee6f. :squirrel: