This repository has been archived on 2026-03-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

1.1 KiB

nginx-s3-upload

Uploads files to s3 bucket. Basically an nginx which proxy_pass HTTP POST requests to S3 directly

Configuration

Environment variables are used to provide configuration.

Variable name Comment 
S3_BUCKET_NAME Mandatory
AWS_REGION Mandatory
RETURN_URL Mandatory
AWS_ACCESS_KEY_ID Optional - will be fetched from IAM policy on AWS
AWS_SECRET_ACCESS_KEY Optional - will be fetched from IAM policy on AWS

Testing

docker run --rm --env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} --env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} --env S3_BUCKET_NAME=upload.example.com --env AWS_REGION=eu-west-1 --env RETURN_URL=images.example.com -p 8000:80 gitlab.com/unboundsoftware/nginx-s3-upload:1.1.0

Try it out:

curl localhost:8000/upload -d 'some data' -v
...
> PUT /upload HTTP/1.1
 ...
< X-File-URL: https://images.example.com/59389abb021973a41d05e0d7d79949b17b83b142058a3704c98f274b6e563cfc403e64db6550f233
...

The header X-File-URL will contain the URL to the uploaded file.