8000 Unify hostnames in returned URLs by simonrw · Pull Request #7774 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 27 commits into from
Mar 20, 2023
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5637712
Start tests for url returning
simonrw Feb 23, 2023
0325017
Add patch_hostnames fixture
simonrw Feb 27, 2023
480bb2f
Add test for s3 location
simonrw Feb 27, 2023
61c4994
Add helpers for configuring the hostname
simonrw Mar 1, 2023
3ede981
Use host utils in opensearch
simonrw Mar 1, 2023
dd812b5
Update S3 to use new host config
simonrw Mar 2, 2023
fe4d980
Cover more cases with SQS tests
simonrw Mar 3, 2023
74abbfb
Partially update SQS to use the new config
simonrw Mar 3, 2023
1a1df4e
Add `assert_host_customisation` fixture
simonrw Mar 3, 2023
91e483f
Update lambda function urls to use new localstack_host function
simonrw Mar 7, 2023
2b5d625
Correct typo with localstack-hostname value
simonrw Mar 8, 2023
c94c3f1
Set localstack_hostname to the hostname of the host
simonrw Mar 8, 2023
edad51b
Handle S3 201 response hostname returning
simonrw Mar 8, 2023
a912dc9
S3 vpath: handle HOSTNAME_EXTERNAL if supplied
simonrw Mar 9, 2023
bae2c59
Update s3 vhosts to use new localstack_host config
simonrw Mar 9, 2023
888059a
Run ASF tests correctly
simonrw Mar 10, 2023
fef6b5c
Run ASF lambda tests correctly
simonrw Mar 10, 2023
53dab3a
Add explanation comment for socket.gethostname
simonrw Mar 10, 2023
9845857
Update `s3_listener._update_location`
simonrw Mar 10, 2023
600d22f
Make suggested changes to sqs tests
simonrw Mar 10, 2023
75176fe
Remove outdated comment
simonrw Mar 13, 2023
fa16a0d
Merge branch 'master' into network-unification
simonrw Mar 15, 2023
263bacb
Merge branch 'master' into network-unification
simonrw Mar 16, 2023
a75d3e1
Merge branch 'master' into network-unification
simonrw Mar 17, 2023
2c5899f
Fix pro integration test with s3
simonrw Mar 17, 2023
46ea0e9
Fix issue with legacy s3 provider
simonrw Mar 17, 2023
ba95b63
Increase timeout of tests
simonrw Mar 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update s3_listener._update_location
This removes a usage of HOSTNAME_EXTERNAL
  • Loading branch information
simonrw committed Mar 10, 2023
commit 9845857a0e55485992f1b0e68491d0c96504eb3a
7 changes: 3 additions & 4 deletions localstack/services/s3/s3_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -1368,12 +1368,11 @@ def get_201_response(key, bucket_name):
def _update_location(content, bucket_name):
bucket_name = normalize_bucket_name(bucket_name)

host = config.HOSTNAME_EXTERNAL
if ":" not in host:
host = f"{host}:{config.service_port('s3')}"
host_definition = localstack_host(use_hostname_external=True)
return re.sub(
r"<Location>\s*([a-zA-Z0-9\-]+)://[^/]+/([^<]+)\s*</Location>",
r"<Location>%s://%s/%s/\2</Location>" % (get_service_protocol(), host, bucket_name),
r"<Location>%s://%s/%s/\2</Location>"
% (get_service_protocol(), host_definition.host_and_port(), bucket_name),
content,
flags=re.MULTILINE,
)
Expand Down
< 3874 /deferred-diff-lines>
0