Fix HEAD requests to s3proxy

This commit is contained in:
Liam 2024-08-17 17:28:56 -04:00
parent 967cbf7b24
commit 25748dc8ff
2 changed files with 2 additions and 2 deletions

View file

@ -76,7 +76,7 @@ end
local function get_hashed_canonical_request(timestamp, host, uri) local function get_hashed_canonical_request(timestamp, host, uri)
local digest = get_sha256_digest(ngx.var.request_body) local digest = get_sha256_digest(ngx.var.request_body)
local canonical_request = ngx.var.request_method .. '\n' local canonical_request = ngx.req.get_method() .. '\n'
.. uri .. '\n' .. uri .. '\n'
.. '\n' .. '\n'
.. 'host:' .. host .. '\n' .. 'host:' .. host .. '\n'

View file

@ -34,7 +34,7 @@ init_by_lua_block {
function sign_aws_request() function sign_aws_request()
-- The API token used should not allow writing, but -- The API token used should not allow writing, but
-- sanitize this anyway to stop an upstream error -- sanitize this anyway to stop an upstream error
if ngx.req.get_method() ~= 'GET' then if ngx.req.get_method() ~= 'GET' and ngx.req.get_method() ~= 'HEAD' then
ngx.status = ngx.HTTP_UNAUTHORIZED ngx.status = ngx.HTTP_UNAUTHORIZED
ngx.say('Unauthorized') ngx.say('Unauthorized')
return ngx.exit(ngx.HTTP_UNAUTHORIZED) return ngx.exit(ngx.HTTP_UNAUTHORIZED)