[Feature] Support virtual host S3 API calls
还没有人认领这个 Issue。
评估
调研方向
先阅读 localstack_client.config.get_endpoint 和 get_service_endpoints,然后使用 boto3 调试日志和 Docker Compose 重现 S3 请求。检查 README.md 中关于 endpoint 的指导,并确定项目应采用所提出的三种方案中的哪一种;done 应包括一条已确定且可正常工作的 virtual-host addressing 路径,以及相应的文档。
由索引模型根据 Issue 内容生成。
描述
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?
- 主要语言
- Python
- 星标
- 191
- 派生
- 31
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
localstack/localstack-python-client 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 4/5 3-5 天 新手友好度 35/100
localstack/localstack-python-client#43 · 4 条评论 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 35/100
localstack/localstack-python-client#38 · 1 条评论 ·
查看 localstack/localstack-python-client 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 86/100
-
🐛 Bug 🔔 Pending processing
难度 2/5 1-3 小时 新手友好度 84/100
jumpserver/jumpserver#17584 ·