How to secure S3 bucket with username and password
![How to secure S3 bucket with username and password](/images/2018/09/data-1590455_1280_hu1c31cd1faa98ad098c17944cb8d78466_244474_640x0_resize_q75_box.jpg)
When you start looking for a solution, you will find answers like using Cloudfront, lambda, and middleware 3rd party services. And basically, you don’t have any other choice. There is no simple solution to your problem. But – as long as you use Caddy Server solution is super easy.
All we need is to have basicauth , and then proxy server to redirect queries. The only problem is a matter of Authorization header. If you pass it “as is as” to S3 – it will cause a problem because expects valid header when data is protected. But if you pass “empty” header it will pass.
example.com.au {
basicauth / username password
proxy / http://s3-ap-southeast-2.amazonaws.com/example.com.au/ {
header_upstream Authorization " "
}
}