Expose common S3 headers in CORS setting (#4839)

fixes #4838
This commit is contained in:
Krishna Srinivas 2017-09-11 08:15:51 -07:00 committed by Dee Koder
parent 6c2bc0568b
commit f66239e82f

View File

@ -326,11 +326,14 @@ var defaultAllowableHTTPMethods = []string{
// setCorsHandler handler for CORS (Cross Origin Resource Sharing) // setCorsHandler handler for CORS (Cross Origin Resource Sharing)
func setCorsHandler(h http.Handler) http.Handler { func setCorsHandler(h http.Handler) http.Handler {
commonS3Headers := []string{"Content-Length", "Content-Type", "Connection",
"Date", "ETag", "Server", "x-amz-delete-marker", "x-amz-id-2",
"x-amz-request-id", "x-amz-version-id"}
c := cors.New(cors.Options{ c := cors.New(cors.Options{
AllowedOrigins: []string{"*"}, AllowedOrigins: []string{"*"},
AllowedMethods: defaultAllowableHTTPMethods, AllowedMethods: defaultAllowableHTTPMethods,
AllowedHeaders: []string{"*"}, AllowedHeaders: []string{"*"},
ExposedHeaders: []string{"ETag"}, ExposedHeaders: commonS3Headers,
AllowCredentials: true, AllowCredentials: true,
}) })
return c.Handler(h) return c.Handler(h)