-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
docker/docker-compose.yml
Outdated
@@ -114,6 +114,9 @@ services: | |||
- "traefik.port=8080" | |||
- "traefik.protocol=https" | |||
- "traefik.docker.network=proxy" | |||
- "traefik.uploads.frontend.redirect.regex=^https?://(.*?).altis.dev/uploads/(.*)" | |||
- "traefik.uploads.frontend.redirect.replacement=https://s3-${COMPOSE_PROJECT_NAME:-default}.altis.dev/uploads/$$2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this use $$1 instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I made that error first time round - there are 2 capturing brackets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I mean instead of the environment variable, not instead of the path replacement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's intentional. The S3 container URL will always be that
@@ -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/(.*)" |
There was a problem hiding this comment.
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??
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub.
git fetch
# Create new working tree.
git worktree add .worktrees/backport v4-branch
# Navigate to the new directory.
cd .worktrees/backport
# Cherry-pick all the commits of this pull request and resolve the likely conflicts.
git cherry-pick f529075a6590e6f6fc401ca61fab1a68cbdb4895 5f9d5fc55cd6d7ba92fc17c31b8c8b1c17c740f0 dee0167fe670d80d15d01c7265b7b3977cd72031
# Create a new branch with these backported commits.
git checkout -b backport-208-to-v4-branch
# Push it to GitHub.
git push --set-upstream origin backport-208-to-v4-branch
# Go back to the original working tree.
cd ../..
# Delete the working tree.
git worktree remove .worktrees/backport Then, create a pull request where the |
After the change to the cloud module to ensure media paths matched the site's host name it broke local server's assumption that the uploads path was at
s3-<project>.altis.dev
.This adds a 301 redirect on the nginx server to map to the correct URL on the S3 container.