localstack / localstack/localstack-python-client
[Feature] Support virtual host S3 API calls
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 191
- Fork
- 31
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
After struggling for several hours with Docker Compose, I noticed my problem was actually in this library, which does not seem to support the virtual host addressing for the s3 client.
Looking at boto3 in debug mode, I noticed that when using Virtual host addressing, the HTTP request was aimed towards http://<bucket>.<endpoint_url>:<endpoint_port>. This is not a valid endpoint, and it should be http://<bucket>.s3.<endpoint_url>:<endpoint_port>, as described here.
After delving deeper I noticed localstack_client.config.get_endpoint it is not handling s3 in any special way. I manually patched the function and noticed that with a simple
def new_get_service_endpoint(
service: str, localstack_host: Optional[str] = None
) -> Optional[str]:
endpoints = localstack_client.config.get_service_endpoints(localstack_host=localstack_host)
endpoint = endpoints.get(service)
if service == "s3":
endpoint = "http://s3." + endpoint.split("http://")[1]
return endpoint
I know this doesn't handle SSL, it's just a draft. It works for both virtual and path based addressing.
I see three ways simple about this:
- Do not support virtual host addressing. This is a problem, as in theory AWS is deprecating path based addressing (also it has been deprecating it for 4 years, so...)
- Do a hack like the one proposed.
- Honor AWS service specific endpoints through envars (for instance
AWS_ENDPOINT_URL_S3) and leave it up to the user to set it up (with appropriate documentation, at least in theREADME.md).
What are your thoughts on this?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia leggendo localstack_client.config.get_endpoint e get_service_endpoints, quindi riproduci la richiesta S3 con il logging di debug di boto3 e Docker Compose. Esamina le indicazioni sugli endpoint in README.md e determina quale dei tre approcci proposti dovrebbe adottare il progetto; done deve includere un percorso di virtual-host addressing deciso e funzionante e la documentazione corrispondente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- aws, python
- Ambito
- api, cloud
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 30/100