zf-fr / zfr-cors

A Zend Framework 2 module that helps you to deal with Cross-Origin Resource Sharing (CORS)
MIT License
60 stars 39 forks source link

NGINX 1.6.2 and preflight response with status 200 #42

Closed boesing closed 7 years ago

boesing commented 7 years ago

Hey guys,

we've got problems with nginx 1.6.2 and the preflight response. We are getting the following error quite often:

2016/10/28 13:57:52 [alert] 11137#0: *9707145 zero size buf in output t:0 r:0 f:1 0000000000000000 0000000000000000-0000000000000000 00000000016944D8 0-0 while sending request to upstream, client: XXX.XXX.XXX.XXX, server: example.com, request: "OPTIONS /foo/bar, host: "example.com"

The response is being redirected to upstream either, but the logs are being flooded. I currently created a workaround with another Listener which checks for preflight request and changes the response status code but I would prefer if there might be no extra listener which manipulates the status code tho.

I've created a PR #41 which will set 204 by default.

boesing commented 7 years ago

Well, just setting the status code to 204 wont fix that issue. Might be a problem with the NGINX configuration. Going to give more feedback here if we got a fix for this.

boesing commented 7 years ago

Just a sidenote: I guess 204 would be the correct response code either and I guess that any browser can interpret this. However, the fix was to update NGINX at all since there were some fixes in newer versions to handle empty responses from upstreams.