Payload on 400 error for HEAD requests #624
Labels
No labels
action
check-aws
action
discussion-needed
action
for-external-contributors
action
for-newcomers
action
more-info-needed
action
need-funding
action
triage-required
kind
correctness
kind
ideas
kind
improvement
kind
performance
kind
testing
kind
usability
kind
wrong-behavior
prio
critical
prio
low
scope
admin-api
scope
background-healing
scope
build
scope
documentation
scope
k8s
scope
layout
scope
metadata
scope
ops
scope
rpc
scope
s3-api
scope
security
scope
telemetry
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Deuxfleurs/garage#624
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When sending a
HEAD /bucket/
request with an incorrect region, the 400 error returned by garage 0.8.2 setup with this script is empty.The tcpdump output (in full below) has:
Is this a misconfiguration of garage? It would be helpful to have more information to display to the Forgejo user when they set the wrong region: this is why there is a particular interest in the content of this error.
18:56:26.595691 IP localhost.9000 > localhost.43304: Flags [.], ack 428, win 509, options [nop,nop,TS val 3833192476 ecr 3833192476], length 0
E..4PS@.@..n........#(.(.c.?.@.......(.....
.y...y..
18:56:26.595855 IP localhost.9000 > localhost.43304: Flags [P.], seq 1:118, ack 428, win 512, options [nop,nop,TS val 3833192477 ecr 3833192476], length 117
E...PT@.@...........#(.(.c.?.@.............
.y...y..HTTP/1.1 400 Bad Request
content-type: application/xml
content-length: 252
date: Thu, 31 Aug 2023 16:56:26 GMT
18:56:26.595864 IP localhost.43304 > localhost.9000: Flags [.], ack 118, win 512, options [nop,nop,TS val 3833192477 ecr 3833192477], length 0
E..4..@.@............(#(.@...c.......(.....
.y...y..
18:56:26.596495 IP localhost.43304 > localhost.9000: Flags [F.], seq 428, ack 118, win 512, options [nop,nop,TS val 3833192477 ecr 3833192477], length 0
E..4..@.@............(#(.@...c.......(.....
.y...y..
18:56:26.596519 IP localhost.9000 > localhost.43304: Flags [F.], seq 118, ack 429, win 512, options [nop,nop,TS val 3833192477 ecr 3833192477], length 0
E..4PU@.@..l........#(.(.c...@.......(.....
.y...y..
18:56:26.596530 IP localhost.43304 > localhost.9000: Flags [.], ack 119, win 512, options [nop,nop,TS val 3833192477 ecr 3833192477], length 0
E..4..@.@............(#(.@...c.......(.....
.y...y..
New discovery : an error response to a HEAD request is not supposed to have a body
I don't think we have specific code to not send the response body if the request is a HEAD, but I wouldn't be surprised if it is the hyper http library that removes it automatically to ensure protocol conformance.
This means that the region redirection mechanism cannot work with just a head request, unfortunately... I think it is implemented in the minio client, and maybe in the minio client library, could we look at how they do it?
@gusted looked at it and found some information. I'll try using GET instead see where that gets me.
Using GET the 400 payload is present, you are correct: HEAD hides it somewhere in the codepath.
Payload on 400 errorto Payload on 400 error for HEAD requestsI'm not sure which way to go to resolve this. I think I'll use a GET request to indirectly assert the region is valid and display a meaningful error message if it does not, using the 400 payload.
But it feels like a hack and there should be a more idiomatic way to do that.
Thoughts?
https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadBucket.html
In any case garage behaves like AWS S3 in that instance and this issue can be closed.
What we are still missing is the
x-amz-bucket-region
though. I'm not sure how it is used by minio to detect the correct region but we should probably add it to garage anyway