mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-25 21:55:56 +03:00
[GH-ISSUE #637] Raise an error for invalid externalURL #114
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#114
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 @adriangb on GitHub (Dec 20, 2021).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/637
Hi, I'm coming here from https://github.com/googleapis/python-storage/issues/604
The TLDR is that inside of docker-compose at least, the
externalURLvalue inferred from server's bind is not valid.Would it be possible to detect this and error out if no
-external-urlparameter was provided by the user? It would avoid a pretty difficult to debug-bug.I also noticed that in the logs I always see
server started at http://[::]:4443even when running out of docker compose, so it seems that maybe the inference of the bound hostname is overall wrong? I don't know enough about golang or low level networking to be able to tell.@fsouza commented on GitHub (Dec 29, 2021):
Hm not sure if we can easily detect a better external URL. We could make it always required, but that would be a breaking change. We could also do something that only affects the Docker image, since I believe that's the environment where people will usually run in this sort of issue (something like an environment variable that turns
-external-urlinto a required parameter? 🙈 )A less intrusive change would be to log a warning? Something like
No -external-url specified, using <...>. Make sure that is accessible by the clientsor something like that.@adriangb commented on GitHub (Dec 29, 2021):
I think a warning would be a good start.
Regarding making it required, could it be required only when calling an endpoint that needs it and when it can't be inferred? It would still technically be a breaking change, but that scenario would lead to a client error anyways so this would just move the error to a more user friendly place.
@stoffeastrom commented on GitHub (Dec 30, 2021):
🤔 Haven't looked into it in detail but I'm thinking maybe it's better to use the
requestto set the correct headers?e.g if you're requesting inside docker network it would look in one way but if you exposed it locally it looks different
from inside
docker-composefrom
localhostmaybe we could just use
@adriangb commented on GitHub (Dec 30, 2021):
Sounds reasonable to me. Does the GCS client include the location header in all languages?
@fsouza commented on GitHub (Dec 30, 2021):
Locationis the response header set by the server, but I think that's a good idea, if-external-urlisn't set, we use the request host. Would potentially need to supportX-Forwarded-Host, but we can start with just the host (proxies can rewriteLocationas needed, and I wouldn't expect anyone to be running fake-gcs-server behind a reverse proxy).