caddy-s3-proxy icon indicating copy to clipboard operation
caddy-s3-proxy copied to clipboard

Write (deferred) headers

Open dbaynard opened this issue 2 years ago • 0 comments
trafficstars

Unlike ResponseWriter.Write, io.Copy doesn't add the deferred headers. Deferred headers are applied after the proxied response.

This (not standalong) is CORS configuration, for example, that only works with the change.

header {
  Access-Control-Allow-Origin "{re.origin.0}"
  Access-Control-Allow-Credentials true
  Access-Control-Expose-Headers "{args[1]}"
  Vary Origin
  defer
}

Fixes #65 (though I suppose there may be issues with PUT and DELETE, too).

(Edit: PUT and, probably, DELETE, are affected, too — this can be merged as is, but if I fix PUT and DELETE beforehand I'll add to this PR.)

dbaynard avatar Nov 09 '23 03:11 dbaynard