nginx-s3-gateway
nginx-s3-gateway copied to clipboard
Add CORS headers, configurable with a CORS_ALLOW_ALL setting
https://github.com/nginxinc/nginx-s3-gateway/issues/62
Example before/after:
$ curl -I -X OPTIONS http://localhost/user/horace/wof_neighborhoods.fgb
HTTP/1.1 405 Not Allowed
Server: nginx
Date: Fri, 14 Oct 2022 21:27:09 GMT
Content-Type: text/html
Content-Length: 150
Connection: keep-alive
Allow: GET, HEAD
$ curl -I -X OPTIONS http://localhost/user/horace/wof_neighborhoods.fgb
HTTP/1.1 204 No Content
Server: nginx
Date: Fri, 14 Oct 2022 21:27:23 GMT
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range
Access-Control-Max-Age: 1728000
Content-Length: 0
Thank you for the PR! I see it is still a draft, so you must be still iterating. All in all this looks, good. I do wonder if it is possible to add an integration test that makes sure that CORS is working as per expectation when enabled.
These changes look solid to me! Is there any progress on this review? @dekobon This would be a very nice feature to have , so using the stubs wouldn't be necessary :)
Hi @dav-pascual and @worace my apologies for the late response. After a lot of thinking, I'd like to implement this in the nginx configuration rather than co-locate it in the AWS/S3 specific JS file.
I've created this PR and I would like your review and testing on it if possible.
@dekobon I think that sounds like a great approach; probably more similar to what other users with prior familiarity with nginx would expect