HubSpot / BuckyServer

Node server that receives metric data over HTTP & forwards to your service of choice
http://github.hubspot.com/bucky
MIT License
195 stars 33 forks source link

CORS issues and 204 response codes from server #4

Closed philososaur closed 10 years ago

philososaur commented 10 years ago

I'm having issues with CORS when using my Bucky Server.

Chrome throws a CORS error when the requests are made, but the Bucky console logger shows that the request metrics were indeed posted.

Collecting index.domContentLoadedEventStart, index.domInteractive, index.domLoading, index.responseEnd, index.responseStart, index.requestStart, index.connectEnd, index.connectStart, index.domainLookupEnd, index.domainLookupStart, index.fetchStart, index.unloadEventEnd, index.unloadEventStart, index.navigationStart for 199.180.243.147

Out of curiosity, I decided to use a Chrome plugin called POSTMAN to manually post to the Bucky Server. The server only responds with 204 responses, and never contains any of the CORS response headers that are supposed to be set. So it seems as though something isn't functioning correctly. Requests to the health check route work fine.

Thanks in advance. -P

zackbloom commented 10 years ago

As of right now, the CORS headers are only included in response to an OPTIONS request, which is sent before the POST request. It sounds like that is working, but the lack of headers in the POST request is triggering the error. I'll modify it to always send the headers.

zackbloom commented 10 years ago

Closed by https://github.com/HubSpot/BuckyServer/commit/e87e1b381330230c2c55d6318886169b53a52351

philososaur commented 10 years ago

Thanks! Verified the fix is working as expected.

jls14 commented 10 years ago

what did you add and how did you add to your header. I am getting a 204 error as well when trying to send from an Angular front end.

zackbloom commented 10 years ago

204 is not an error, it just means success without a response. If you have code checking the response code, it should include 204 as a successful response.