mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-25 13:45:52 +03:00
[GH-ISSUE #1785] Add feature to disable publicHostMatcher #222
Labels
No labels
bug
compatibility-issue
docker
documentation
enhancement
help wanted
needs information
pull-request
question
stale
unfortunate
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/fake-gcs-server#222
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zounar on GitHub (Oct 18, 2024).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1785
I have a
fake-gcs-serverrun in Docker Compose and I have troubles with the publicHostMatcher. Because I need to specify some host in thepublicHostarg, I can either set the container to be accessible from the host (vialocalhost) or via internal Docker network (via the service name), but not both.This makes it practically impossible for me to use this tool (without some complex proxy). Note that
network_mode: hostis not an option for me as it's available only on Linux, and I'm running a WSL.I believe it could be very handy to have the ability to either:
publicHostarg,publicHost,publicHostMatcherto be skipped.I think having this security layer for a tool that seems to be used primarily for local development and testing is unneccessary.
Thanks for considering! 🙂
@fsouza commented on GitHub (Oct 28, 2024):
Can you try using the internal config endpoint? There are no docs, but this is what the body looks like:
github.com/fsouza/fake-gcs-server@b48d95f67e/fakestorage/config.go (L9-L12)So you'd do something like:
@zounar commented on GitHub (Oct 29, 2024):
Thanks for this proposal, and while it could be used as a hotfix 👍, it would be very nasty to change this config (twice) each time I call the service 🥺. (Twice because I'd need to re-set it back, otherwise I wouldn't be able to access the files via browser.)
@fsouza commented on GitHub (Oct 30, 2024):
@zounar I'm confused, you would only need to set it once, as soon as you know the host, no? That's what it was introduced for, see the discussion in #659: a "public host" is required for redirect and resumable uploads to work, the idea is that once you know what the public host will be, you can call the internal config endpoint.
@zounar commented on GitHub (Nov 2, 2024):
I see now. Unfortunately, I'm running it locally (with Docker Compose), and I use two different hostnames. One of them being
localhost(to access the Fake GCS from the browser) and the other is an internal Docker network (to access the Fake GCS from the application container). I don't use resumable uploads, the whole system is just a substitution for a real GCS in development.@anz-rfc-v2 commented on GitHub (Nov 6, 2024):
I have a similar use case, we are running
fake-gcs-serverin a container via docker compose, where for technical reasons we're not usingnetwork_mode: host. we need to connect to thefake-gcs-servercontainer from sibling containers and also from the host machine outside of dockeri found a workaround that works for my situation:
fake-gcs-serversetting publicHost to match the docker-compose service name (so sibling containers in the same docker-compose can connect to it and have object downloads work)one of my colleagues suggested another workaround could be to deploy fake-gcs-server behind something like nginx and use nginx to rewrite the host header of inbound requests (pretty heavyweight)
@zounar commented on GitHub (Nov 6, 2024):
It's an interesting solution 👍, although a bit overkill, as you mentioned.
Given that my use-case doesn't require a GCS-specific API but just a basic S3-compatible API, I decided to move to a different package. Thanks though 🙂.