The test suites for javascript-aws-sdk-v3 and python-botocore demonstrate that host prefixes break with incompatible custom endpoints such as sync-127.0.0.1 or sync-localhost.
AWS reference guide for custom endpoints: https://docs.aws.amazon.com/sdkref/latest/guide/feature-ss-endpoints.html
Requirements: Node.js (e.g., v22.14.0) and Python (e.g., 3.11.7)
- Install and start LocalStack (community version is sufficient)
- Install dependencies via
make install - Run tests via
make test
The test case test_host_prefix_endpoint_url demonstrates the two failure scenarios for the custom endpoints:
- ❌
http://127.0.0.1:4566creates a technically unresolvable hostsync-127.0.0.1 - ❌
http://localhost:4566creates a technically unresolvable hostsync-localhost(unless modifying/etc/hosts) - ✅
http://localhost.localstack.cloud:4566works unless DNS rebind protection blocks resolving the DNS name to127.0.0.1using public LocalStack DNS entries. In this example, our DNS entry resolvessync-localhost.localstack.cloudto127.0.0.1. Background blog post: How we are making connecting to LocalStack easier
The test case test_no_host_prefix_endpoint_url succeeds to demonstrate that disabling the host prefix using disableHostPrefix: true (hostPrefixEnabled is deprecated) works.
The test case test_host_prefix_endpoint_url demonstrates the two failure scenarios for the custom endpoints:
- ❌
http://127.0.0.1:4566creates a technically unresolvable hostsync-127.0.0.1 - ❌
http://localhost:4566creates a technically unresolvable hostsync-localhost(unless modifying/etc/hosts) - ✅
http://localhost.localstack.cloud:4566works unless DNS rebind protection blocks resolving the DNS name to127.0.0.1using public LocalStack DNS entries. In this example, our DNS entry resolvessync-localhost.localstack.cloudto127.0.0.1. Background blog post: How we are making connecting to LocalStack easier
The test case test_no_host_prefix_endpoint_url succeeds to demonstrate that omitting the host prefix using inject_host_prefix=False works.