Skip to content

Commit

Permalink
update template to support prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
zironycho committed Jul 7, 2020
1 parent b1e86b3 commit fa891d4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
FROM nginx:1.19.0-alpine
COPY ./templates /etc/nginx/templates
ENV PATH_PREFIX=/
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ up:

down:
@docker-compose down

ps:
@docker-compose ps
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# aws s3 proxy

### envs:
AWS_BUCKET={{your-bucket}}

|usecase|descript|required|
|-|-|-|
|AWS_BUCKET=my-aws-bucket|user aws bucket|true|
|PATH_PREFIX=/my-s3/|prefix. It must be starts/ends with slash|false|

### healthcheck:
curl http://localhost:8080/health
3 changes: 2 additions & 1 deletion templates/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ server {
return 200 "ok";
}

location / {
location ${PATH_PREFIX} {
rewrite ^${PATH_PREFIX}(.*)$ /$1 break;
proxy_pass http://${AWS_BUCKET}.s3.amazonaws.com;
}
}

0 comments on commit fa891d4

Please sign in to comment.