-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Unify hostnames in returned URLs #7774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
5637712
0325017
480bb2f
61c4994
3ede981
dd812b5
fe4d980
74abbfb
1a1df4e
91e483f
2b5d625
c94c3f1
edad51b
a912dc9
bae2c59
888059a
fef6b5c
53dab3a
9845857
600d22f
75176fe
fa16a0d
263bacb
a75d3e1
2c5899f
46ea0e9
ba95b63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
from queue import PriorityQueue | ||
from typing import Dict, NamedTuple, Optional, Set | ||
|
||
from localstack import config, constants | ||
from localstack import config | ||
from localstack.aws.api import RequestContext | ||
from localstack.aws.api.sqs import ( | ||
InvalidAttributeName, | ||
|
@@ -21,7 +21,7 @@ | |
ReceiptHandleIsInvalid, | ||
TagMap, | ||
) | ||
from localstack.config import external_service_url | ||
from localstack.config import get_protocol | ||
from localstack.services.sqs import constants as sqs_constants | ||
from localstack.services.sqs.exceptions import ( | ||
InvalidAttributeValue, | ||
|
@@ -35,6 +35,7 @@ | |
) | ||
from localstack.services.stores import AccountRegionBundle, BaseStore, LocalAttribute | ||
from localstack.utils.time import now | ||
from localstack.utils.urls import localstack_host | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
@@ -249,13 +250,18 @@ def url(self, context: RequestContext) -> str: | |
# or us-east-2.queue.localhost.localstack.cloud:4566/000000000000/my-queue | ||
region = "" if self.region == "us-east-1" else self.region + "." | ||
scheme = context.request.scheme | ||
host_url = f"{scheme}://{region}queue.{constants.LOCALHOST_HOSTNAME}:{config.EDGE_PORT}" | ||
|
||
host_definition = localstack_host(use_localhost_cloud=True) | ||
host_url = f"{scheme}://{region}queue.{host_definition.host_and_port()}" | ||
elif config.SQS_ENDPOINT_STRATEGY == "path": | ||
# https?://localhost:4566/queue/us-east-1/00000000000/my-queue (us-east-1) | ||
host_url = f"{context.request.host_url}/queue/{self.region}" | ||
else: | ||
if config.SQS_PORT_EXTERNAL: | ||
host_url = external_service_url("sqs") | ||
host_definition = localstack_host( | ||
use_hostname_external=True, custom_port=config.SQS_PORT_EXTERNAL | ||
) | ||
host_url = f"{get_protocol()}://{host_definition.host_and_port()}" | ||
Comment on lines
260
to
+264
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hey! i can see that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR is just matching existing behaviour. I'll get rid of it in a follow up PR targeting the |
||
|
||
return "{host}/{account_id}/{name}".format( | ||
host=host_url.rstrip("/"), | ||
|
Uh oh!
There was an error while loading. Please reload this page.