Skip to content
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

set content type of the object gives 403 error #14

Open
shebin-nginx opened this issue Jul 1, 2020 · 5 comments
Open

set content type of the object gives 403 error #14

shebin-nginx opened this issue Jul 1, 2020 · 5 comments

Comments

@shebin-nginx
Copy link

local headers = util.new_headers()
headers['Content-Type']= 'text/plain'
...
....
local ok, response = s3:put("key", "value", header)

@shebin-nginx
Copy link
Author

SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided.

@jie123108
Copy link
Owner

I passed the test with your case. It works in both s3 and minio. Can you check, if there is something wrong with the s3 configuration?

@shebin-nginx
Copy link
Author

shebin-nginx commented Jul 6, 2020

i use eu-west-1 .. everything works fine without the headers parameter
local ok, response = s3:put("key", "value") -> 200 ok and value in bucket
but
local ok, response = s3:put("key", "value", header) ->403

local headers = util.new_headers()
headers['Content-Type']= 'text/plain'
headers['Content-Encoding'] = 'None'

local s3 = awss3:new(aws_id, aws_secret, aws_bucket, {timeout=1000*10, aws_region=aws_region})

local ok, response = s3:put("test/key1", "data1", headers)
local ok, response = s3:put("test/key2", "data2",headers)

status:403, body:
SignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your key and signing method.*****AWS4-HMAC-SHA256

** im calling it from nginx timer

@jie123108
Copy link
Owner

I'm sorry, I wasn't able to reproduce the issue, I used a eu-west-1 bucket for the test, and again Added the "Content-Type" header to the put request in test-s3.lua: test_01put() . But both requests were successful. You can test this by replacing it with your corresponding configuration with the following command:

cd path/to/lua-resty-s3
S3_CONFIG="S3_ACCESS_ID:S3_ACCESS_SECERT_KEY:resty-s3-eu-west-1:eu-west-1" resty -I lib test/test-s3.lua

@shebin-nginx
Copy link
Author

Ok ... I tried to run hardcording those values in Auth classs it works fine

But when i run from the ngx.timer.at(0, func) context (even non modified util.headers ) gives unauthorized. bit strange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants