aws-s3-reverse-proxy
aws-s3-reverse-proxy copied to clipboard
X-Amz-Date header missing or set multiple times
We have a Django Application ( Netbox) which uses the Django backend for S3. This doesnt set headers but instead puts things into the URL which leads to this error:
X-Amz-Date header missing or set multiple times: &{GET /netbox-test/devicetype-images/2021-03-02_13_28_22-ASR-9910.jpg_700800.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=OMKK45MUP3A21NUFBAMO%2F20210901%2Ffx%2Fs3%2Faws4_request&X-Amz-Date=20210901T194621Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=8cd5167be8363d44b437e2ddb9b09dcb7e2622375e3122d18c370ca7b7ff1a4b HTTP/1.1 1 1 map[Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9] Accept-Encoding:[gzip, deflate, br] Accept-Language:[en-GB,en-US;q=0.9,en;q=0.8,de;q=0.7] Cookie:[CONSENTMGR=consent:true|ts:1622119709217; wt_ttv2_s_196380495960676=9999; SAPWP_active=1; wt3_sid=%3B943593591056212%3B700378032410688%3B896369902135262; utag_main=v_id:017b9e117cb60019cfa8f2fe36a202069008406101788$_sn:2$_ss:0$_st:1630497112174$ses_id:1630495283764%3Bexp-session$_pn:8%3Bexp-session; wt3_eid=%3B943593591056212%7C2162972062014115676%232163049134992127594%3B700378032410688%7C2162998334043534258%232163049531157297740%3B896369902135262%7C2162998334087666506%232163049531287865764; wt_rla=943593591056212%2C20%2C1630491121687%3B700378032410688%2C5%2C1630495284161%3B896369902135262%2C4%2C1630495284251; _oauth2_proxy=tNL3RjEJLxE0V-3hZk0_BQNt_kCNCCTQJHs7zeNpPEDRAiwa-QoWtQysdpspA_MLS5L9DAJQv7O8WDJ0I9lQzyQYoGfgoE142AyJsyVTVsjLuFIxyQW1JhVyuptBhN3lkUArNHlN15826fVZSbP2KXOGOb3UQj4LsOQmCVunaxeyeETs3kTqbigGz_SAi1Q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_MYtD0l1ig1MnLcDwCqgH_jLG2fAOh7cZXA0slpF37pKNFIu3pZ1XS1a5nce3Gvzu4w--Q5SJbyD99hgjRJgY3Id7oZNGgvnQqOokPc2cnnRYvw9fke-8b_QCZWj_bfVIO376P|1630509542|9Kw5U7pvkklkmlVsk8pX2txQTPjl-H9TBpBeR-5hy8Y=; csrftoken=4jGnRUwzXAORCKRbEduMCRHBsStKM6l5Y3hQCFffudRVgKcqAnMP813Q8QQioYzP; sessionid=mqz6u2cu16xowpwk0kte09g60ksiad56] Referer:[https://netbox.hb.das-schiff.telekom.de/dcim/device-types/25/] Sec-Ch-Ua:[" Not A;Brand";v="99", "Chromium";v="92"] Sec-Ch-Ua-Mobile:[?0] Sec-Fetch-Dest:[document] Sec-Fetch-Mode:[navigate] Sec-Fetch-Site:[same-origin] Sec-Fetch-User:[?1] Upgrade-Insecure-Requests:[1] User-Agent:[Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36] X-Forwarded-For:[10.27.50.159] X-Forwarded-Host:[netbox.hb.das-schiff.telekom.de] X-Forwarded-Port:[443] X-Forwarded-Proto:[https] X-Real-Ip:[10.27.50.159] X-Request-Id:[0ac451fcb2b561c5bbfcc1aabafdbdfc] X-Scheme:[https]] {} <nil> 0 [] false netbox.hb.das-schiff.telekom.de map[] map[] <nil> map[] 192.168.90.70:37558 /netbox-test/devicetype-images/2021-03-02_13_28_22-ASR-9910.jpg_700800.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=OMKK45MUP3A21NUFBAMO%2F20210901%2Ffx%2Fs3%2Faws4_request&X-Amz-Date=20210901T194621Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=8cd5167be8363d44b437e2ddb9b09dcb7e2622375e3122d18c370ca7b7ff1a4b <nil> <nil> <nil> 0xc000396700}
I think you are referring to pre-signed URLs / query parameters as described in https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
Unfortunately this is currently not implemented - only headers are considered at the moment.
I'd be happy to review and merge a PR!
Will see if i find time for it next week, shouldnt be too hard, as you current code looks quite expandable for this on the first glance
@MaxRink @Kriechi any plans to add this?
My error seems to be different
AccessDenied: There were headers present in the request which were not signed HeadersNotSigned: 'x-amz-request-payer, x-amz-user-agent'
Unfortunately I don't know golang :(