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

Fix use of uploads directory on local server #208

Merged
merged 3 commits into from
Aug 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ x-php: &php
AWS_XRAY_DAEMON_HOST: xray
S3_UPLOADS_ENDPOINT: https://altis.dev/
S3_UPLOADS_BUCKET: s3-${COMPOSE_PROJECT_NAME:-default}
S3_UPLOADS_BUCKET_URL: https://s3-${COMPOSE_PROJECT_NAME:-default}.altis.dev
S3_UPLOADS_BUCKET_URL: https://${COMPOSE_PROJECT_NAME:-default}.altis.dev
S3_UPLOADS_KEY: admin
S3_UPLOADS_SECRET: password
S3_UPLOADS_REGION: us-east-1
Expand Down Expand Up @@ -114,6 +114,10 @@ services:
- "traefik.port=8080"
- "traefik.protocol=https"
- "traefik.docker.network=proxy"
# Redirect any requests to /uploads to the S3 container frontend.
- "traefik.uploads.frontend.redirect.regex=^https?://(?:.*?).altis.dev/uploads/(.*)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to check, this won't cause an infinite redirect right??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did test it 😛 - the traefik rules apply first before the request gets to the container so s3-*.altis.dev requests are never handled by nginx.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WHen this says "redirect" does it mean HTTP redirect? If so, is this just used for legacy URLs? Just want to make sure we are not always issuing 301 redirects!

- "traefik.uploads.frontend.redirect.replacement=https://s3-${COMPOSE_PROJECT_NAME:-default}.altis.dev/uploads/$$1"
- "traefik.uploads.frontend.redirect.permanent=true"
- "traefik.frontend.rule=HostRegexp:${COMPOSE_PROJECT_NAME:-default}.altis.dev,{subdomain:[a-z._-]+}.${COMPOSE_PROJECT_NAME:-default}.altis.dev"
xray:
image: amazon/aws-xray-daemon:3.0.1
Expand Down