Closed whummer closed 9 months ago
This might be hard to achieve across the entire LocalStack ecosystem. For an auto-magic workaround, we would need to parse the URL and check if it contains localhost and then apply the check as we do it for hostname ATM.
Great point, thanks for the pointer and giving it a try - almost forgot about this node 18 / IPv6 issue again. 😬 Changing the getServiceURL
function to async
would be one option, but I think we've considered this in the past, and it turned out to be painful to introduce async logic in all places. Updating the docs could be another option, but agree that this could be error-prone and not really user-friendly.
What we could do, though: since we're already passing in the hostname
(at least when calling it from reconfigureAWS(..)
), we could simply replace the hostname/IP in the URL as you suggested, in case AWS_ENDPOINT_URL
looks something like http://localhost:4566
. 👍 Will go ahead and make that change.
Unify construction of target endpoint URL, add support for configuring
$AWS_ENDPOINT_URL
. The starting point for this PR was a use case where we want to deploy a serverless/bref application against an ephemeral LocalStack instance (running on Namespace).It turned out that the current configuration options still use the deprecated config options like
EDGE_PORT
/USE_SSL
/etc, which we've already removed and replaced withAWS_ENDPOINT_URL
in other util repos (e.g.,tflocal
,cdklocal
).Another issue was that Namespace has some issues routing requests if a request is made with a
Host
header that contains the default HTTPS port 443 (i.e.,Host: my-remote-host:443
). Arguably, we should not be making custom adjustments for a single target platform, but it seems reasonable to replacehttps://my-remote-host:443
withhttps://my-remote-host
, as this is generally a common practice for addressing HTTPS Web servers.Note that the entire logic becomes obsolete with the
AWS_ENDPOINT_URL
variable, and we can simplify the logic quite a bit in an upcoming release, once we remove the legacy configuration options. 👍Changes:
AWS_ENDPOINT_URL
AWS_ENDPOINT_URL
, deprecating the old config options