localstack / localstack/localstack-python-client
[Feature] Support virtual host S3 API calls
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 191
- 分支
- 31
- PR 合併指標
- 30 天內沒有已合併 PR
描述
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://.:`. This is not a valid endpoint, and it should be `http://.s3.:`, as described [here](https://docs.localstack.cloud/user-guide/aws/s3/#path-style-and-virtual-hosted-style-requests).
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
```python3
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:
1. 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...)
2. Do a hack like the one proposed.
3. 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 the `README.md`).
What are your thoughts on this?
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先閱讀 localstack_client.config.get_endpoint 和 get_service_endpoints,接著使用 boto3 偵錯記錄和 Docker Compose 重現 S3 請求。檢視 README.md 中的 endpoint 指引,並判斷專案應採用所提出的三種方法中的哪一種;done 應包含一條已決定且可正常運作的 virtual-host addressing 路徑,以及相應的文件。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- aws, python
- 領域
- api, cloud
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 30/100