-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deferred (CORS) headers not propagated #65
Comments
I think my hypothesis was correct? route @origin {
header X-Before-Proxy true
header >X-Before-Proxy-Deferred true
s3proxy {
bucket "bubblx-storage"
region "eu-west-1"
}
header X-After-Proxy true
header >X-After-Proxy-Deferred true
} That resulted in this. GET /s3proxy HTTP/1.1
Accept: */*
Accept-Encoding: identity
Connection: keep-alive
Host: api.example.com
User-Agent: HTTPie/3.2.2
origin: https://origin.example.com
x-preflight: true
HTTP/1.1 200 OK
Alt-Svc: h3=":443"; ma=2592000
Content-Type: audio/wav
Date: Wed, 08 Nov 2023 17:23:52 GMT
Etag: "<ELIDED>"
Last-Modified: <ELIDED>
Server: Caddy
Transfer-Encoding: chunked
X-Before-Proxy: true So only the non-deferred header, works, and only before the call to What I don't understand is why it is I suppose I could leave the default as is, and extend |
OK it's not that; it's that As described in This is what Or, at least that's what I infer, as calling Plausibly it ought to |
Following the CORS configuration in caddyserver/website#324 (comment) I see that my endpoint using caddy-s3-proxy doesn't defer the response headers.
Could it be because this module doesn't callEdit: it's not, the code needs to callnext.ServeHttp(w, r)
in the success case?ResponseWriter.WriteHeaders
.This is blocking CORS requests from working, as the
Access-Control-Allow-Origin
header is not present on the response.I've sanitized the following output (from httpie).
This is the non–caddy-s3-proxy endpoint.
This is the caddy-s3-proxy one.
Note, in particular, the lack of the
Access-Control-Allow-Origin
header; this means that CORS requests do not work.I've read #33 but this seems different, as the headers should be set already (due to the
defer
).Does this sound like a feature that is missing? And if so, and you don't have an alternative that you recommend for CORS, would you consider this a bug?
In that case, I can dig through the code to try to fix this, but it might be an obvious solution to you — I've skimmed https://github.com/lindenlab/caddy-s3-proxy/blob/850db193cb7f48546439d236f2a6de7bd7436e2e/s3proxy.go and found the code calls
return nil
inServeHttp
.caddy-s3-proxy/s3proxy.go
Lines 361 to 374 in 850db19
Should it be calling
return next.ServeHttp(w, r)
, as it does in the error case?caddy-s3-proxy/s3proxy.go
Lines 398 to 402 in 850db19
The text was updated successfully, but these errors were encountered: