All POST requests fail with An error occurred when parsing the HTTP request POST at '/' #18546
Replies: 3 comments 1 reply
-
I am experiencing the same problem. Did you manage to find a solution? |
Beta Was this translation helpful? Give feedback.
-
I'm able to get this curl -X POST http://127.0.0.1:9000/all \
-F "x-amz-algorithm=AWS4-HMAC-SHA256" \
-F "x-amz-credential=minioadmin/20240415/us-east-1/s3/aws4_request" \
-F "x-amz-date=20240415T090019Z" \
-F "policy=eyJleHBpcmF0aW9uIjogIjIwMjQtMDQtMTZUMDk6MDA6MTkuOTkzWiIsICJjb25kaXRpb25zIjogW1siZXEiLCAiJGJ1Y2tldCIsICJhbGwiXSwgWyJzdGFydHMtd2l0aCIsICIka2V5IiwgIk1hIl0sIFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLCAxLCAxMDQ4NTc2MF0sIFsiZXEiLCAiJHgtYW16LWFsZ29yaXRobSIsICJBV1M0LUhNQUMtU0hBMjU2Il0sIFsiZXEiLCAiJHgtYW16LWNyZWRlbnRpYWwiLCAibWluaW9hZG1pbi8yMDI0MDQxNS91cy1lYXN0LTEvczMvYXdzNF9yZXF1ZXN0Il0sIFsiZXEiLCAiJHgtYW16LWRhdGUiLCAiMjAyNDA0MTVUMDkwMDE5WiJdXX0=" \
-F "x-amz-signature=ad19470138791ff028fab00a88908ae2036cbb3fdcceafcab37e9a9fb9ccdc9d" \
-F "Key=Makefile" \
-F file=@Makefile , but when I attempt to do it using a golang |
Beta Was this translation helpful? Give feedback.
-
I faced this problem myself. Thanks to this post, it gave me the clues I was after. In the original post, there was the following data:
I can see two problems:
Another problem that was particular to my situation - I hadn't configured encryption in my Minio server. However the sample code I was using looked like this: def sign_form_upload(config, bucket, opts) do
key = Keyword.fetch!(opts, :key)
max_file_size = Keyword.fetch!(opts, :max_file_size)
content_type = Keyword.fetch!(opts, :content_type)
expires_in = Keyword.fetch!(opts, :expires_in)
expires_at = DateTime.add(DateTime.utc_now(), expires_in, :millisecond)
amz_date = amz_date(expires_at)
credential = credential(config, expires_at)
encoded_policy =
Base.encode64("""
{
"expiration": "#{DateTime.to_iso8601(expires_at)}",
"conditions": [
{"bucket": "#{bucket}"},
["eq", "$key", "#{key}"],
{"acl": "public-read"},
["eq", "$Content-Type", "#{content_type}"],
["content-length-range", 0, #{max_file_size}],
{"x-amz-server-side-encryption": "AES256"},
{"x-amz-credential": "#{credential}"},
{"x-amz-algorithm": "AWS4-HMAC-SHA256"},
{"x-amz-date": "#{amz_date}"}
]
}
""")
fields = %{
"key" => key,
"acl" => "public-read",
"content-type" => content_type,
"x-amz-server-side-encryption" => "AES256",
"x-amz-credential" => credential,
"x-amz-algorithm" => "AWS4-HMAC-SHA256",
"x-amz-date" => amz_date,
"policy" => encoded_policy,
"x-amz-signature" => signature(config, expires_at, encoded_policy)
}
{:ok, fields}
end I had to remove both references to Leaving this here in case it helps |
Beta Was this translation helpful? Give feedback.
-
When attempting to perform presigned POST upload, all requests fail with HTTP 400 and the following response:
Since I'm new to
minio
, there is a high chance that I am doing something wrong. However, I am able to perform the upload to Digital Ocean Spaces with the same code.These are parameters that I use to prepare form data:
However, regardless of what I include in the POST request, the error is always the same.
I simplified the reproduction to following command:
curl -L localhost:9000 -X POST
What could be important is that no log/error appears in
mc admin trace -v
for any POST request to minio.Issuing
curl -L localhost:9000 -X GET
responds correctly with Access Denied error and adds relevant record to log.It appears like if POST requests do not even reach minio.
When I issue
http://localhost:9000/bucket/test
, the error is:Expected Behavior
I would expect POST request to make a record in
mc admin trace -v
.I would also expect the request to fail on Access Denied.
And I would expect that correcly prepared POST payload with presigned data would upload a file successfully.
Current Behavior
An error occurred when parsing the HTTP request POST
Possible Solution
Steps to Reproduce (for bugs)
curl -L localhost:9000 -X POST
Context
I'm trying to perform presigned POST upload. However, it seems that all POST requests fail.
Regression
no
Your Environment
RELEASE.2023-11-20T22-40-07Z (go1.21.4 linux/arm64)
localhost:9000, docker image
Darwin HOSTNAME.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:45 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6020 arm64
Beta Was this translation helpful? Give feedback.
All reactions