This repository was archived by the owner on Mar 23, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
localstack-core/localstack/services/apigateway Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -984,20 +984,20 @@ def is_variable_path(path_part: str) -> bool:
984984 return path_part .startswith ("{" ) and path_part .endswith ("}" )
985985
986986
987- def get_domain_name_hash (domain_name : str ) -> str :
987+ def get_domain_name_hash (domain_name : str , region_name : str ) -> str :
988988 """
989989 Return a hash of the given domain name, which help construct regional domain names for APIs.
990990 TODO: use this in the future to dispatch API Gateway API invocations made to the regional domain name
991991 """
992- return hashlib .shake_128 (to_bytes (domain_name )).hexdigest (4 )
992+ return hashlib .shake_128 (to_bytes (domain_name + region_name )).hexdigest (4 )
993993
994994
995- def get_regional_domain_name (domain_name : str ) -> str :
995+ def get_regional_domain_name (domain_name : str , region_name : str ) -> str :
996996 """
997997 Return the regional domain name for the given domain name.
998998 In real AWS, this would look something like: "d-oplm2qchq0.execute-api.us-east-1.amazonaws.com"
999999 In LocalStack, we're returning this format: "d-<domain_hash>.execute-api.localhost.localstack.cloud"
10001000 """
1001- domain_name_hash = get_domain_name_hash (domain_name )
1001+ domain_name_hash = get_domain_name_hash (domain_name , region_name )
10021002 host = localstack_host ().host
10031003 return f"d-{ domain_name_hash } .execute-api.{ host } "
Original file line number Diff line number Diff line change @@ -562,7 +562,7 @@ def create_domain_name(
562562 domainName = domain_name ,
563563 certificateName = certificate_name ,
564564 certificateArn = certificate_arn ,
565- regionalDomainName = get_regional_domain_name (domain_name ),
565+ regionalDomainName = get_regional_domain_name (domain_name , context . region ),
566566 domainNameStatus = DomainNameStatus .AVAILABLE ,
567567 regionalHostedZoneId = zone_id ,
568568 regionalCertificateName = regional_certificate_name ,
You can’t perform that action at this time.
0 commit comments