From 80375f82d50711bf9f4cc081bc09eaac7c3464ca Mon Sep 17 00:00:00 2001 From: Richard Wang Date: Wed, 21 Jan 2026 13:42:40 -0800 Subject: [PATCH 1/3] Add config option for disabling region detection --- gems/aws-sdk-sqs/CHANGELOG.md | 2 ++ gems/aws-sdk-sqs/lib/aws-sdk-sqs/client.rb | 3 +++ .../lib/aws-sdk-sqs/plugins/queue_urls.rb | 15 +++++++++++ gems/aws-sdk-sqs/sig/client.rbs | 1 + gems/aws-sdk-sqs/sig/resource.rbs | 1 + .../spec/client/queue_urls_spec.rb | 26 +++++++++++++++++++ 6 files changed, 48 insertions(+) diff --git a/gems/aws-sdk-sqs/CHANGELOG.md b/gems/aws-sdk-sqs/CHANGELOG.md index 750c0f6ddef..0b96787143a 100644 --- a/gems/aws-sdk-sqs/CHANGELOG.md +++ b/gems/aws-sdk-sqs/CHANGELOG.md @@ -1,6 +1,8 @@ Unreleased Changes ------------------ +* Feature - Support disabling queue url region detection. + 1.110.0 (2026-01-16) ------------------ diff --git a/gems/aws-sdk-sqs/lib/aws-sdk-sqs/client.rb b/gems/aws-sdk-sqs/lib/aws-sdk-sqs/client.rb index b545b9edd1f..f728973e6e5 100644 --- a/gems/aws-sdk-sqs/lib/aws-sdk-sqs/client.rb +++ b/gems/aws-sdk-sqs/lib/aws-sdk-sqs/client.rb @@ -217,6 +217,9 @@ class Client < Seahorse::Client::Base # When set to 'true' the request body will not be compressed # for supported operations. # + # @option options [Boolean] :disable_url_region_detection (false) + # When set to `true`, the region will not be extracted from a provided queue url. Defaults to `false`. + # # @option options [String, URI::HTTPS, URI::HTTP] :endpoint # Normally you should not configure the `:endpoint` option # directly. This is normally constructed from the `:region` diff --git a/gems/aws-sdk-sqs/lib/aws-sdk-sqs/plugins/queue_urls.rb b/gems/aws-sdk-sqs/lib/aws-sdk-sqs/plugins/queue_urls.rb index 5c8696d26b0..187eee2f590 100644 --- a/gems/aws-sdk-sqs/lib/aws-sdk-sqs/plugins/queue_urls.rb +++ b/gems/aws-sdk-sqs/lib/aws-sdk-sqs/plugins/queue_urls.rb @@ -5,6 +5,19 @@ module SQS module Plugins # @api private class QueueUrls < Seahorse::Client::Plugin + # When set to `true`, the signing region will not be modified if the configured + # region does not match the region extracted from a provided queue url. + # + # When set to 'false', the signing region will be modified to use the region + # extracted from a provided queue url if it differs from the configured region. + option( + :disable_url_region_detection, + default: false, + doc_type: 'Boolean', + docstring: <<~DOCS) + When set to `true`, the region will not be extracted from a provided queue url. Defaults to `false`. + DOCS + # Extract region from a provided queue_url class Handler < Seahorse::Client::Handler def call(context) @@ -22,6 +35,8 @@ def update_endpoint(context, url) # If the region in the queue url is not the configured # region, then we will modify signing to use it def update_region(context, queue_url) + return if context.config.disable_url_region_detection + if (queue_region = parse_region(queue_url)) && queue_region != context.config.region context[:auth_scheme]['signingRegion'] = queue_region diff --git a/gems/aws-sdk-sqs/sig/client.rbs b/gems/aws-sdk-sqs/sig/client.rbs index 1ada83baf19..b8f9a872d0d 100644 --- a/gems/aws-sdk-sqs/sig/client.rbs +++ b/gems/aws-sdk-sqs/sig/client.rbs @@ -29,6 +29,7 @@ module Aws ?defaults_mode: String, ?disable_host_prefix_injection: bool, ?disable_request_compression: bool, + ?disable_url_region_detection: bool, ?endpoint: String, ?endpoint_cache_max_entries: Integer, ?endpoint_cache_max_threads: Integer, diff --git a/gems/aws-sdk-sqs/sig/resource.rbs b/gems/aws-sdk-sqs/sig/resource.rbs index 1ff334c2a2e..96ba1fe7738 100644 --- a/gems/aws-sdk-sqs/sig/resource.rbs +++ b/gems/aws-sdk-sqs/sig/resource.rbs @@ -29,6 +29,7 @@ module Aws ?defaults_mode: String, ?disable_host_prefix_injection: bool, ?disable_request_compression: bool, + ?disable_url_region_detection: bool, ?endpoint: String, ?endpoint_cache_max_entries: Integer, ?endpoint_cache_max_threads: Integer, diff --git a/gems/aws-sdk-sqs/spec/client/queue_urls_spec.rb b/gems/aws-sdk-sqs/spec/client/queue_urls_spec.rb index c39b9c8fbf3..a3dbd22035e 100644 --- a/gems/aws-sdk-sqs/spec/client/queue_urls_spec.rb +++ b/gems/aws-sdk-sqs/spec/client/queue_urls_spec.rb @@ -81,6 +81,32 @@ module SQS expect(resp.context.http_request.headers['authorization']) .to include('us-west-2') end + + it 'disables region detection when disable_url_region_detection is true' do + url = 'https://sqs.us-west-2.amazonaws.com/1234567890/demo' + client = Client.new( + stub_responses: true, + region: 'us-east-1', + disable_url_region_detection: true + ) + resp = client.send(method, params.merge(queue_url: url)) + expect(resp.context.http_request.headers['authorization']) + .to include('us-east-1') + expect(resp.context.http_request.headers['authorization']) + .not_to include('us-west-2') + end + + it 'uses configured region for custom endpoints when detection disabled' do + url = 'https://sqs.elb-proxy.elb-gamma.us-east-1.amazonaws.com/1234567890/demo' + client = Client.new( + stub_responses: true, + region: 'us-east-1', + disable_url_region_detection: true + ) + resp = client.send(method, params.merge(queue_url: url)) + expect(resp.context.http_request.headers['authorization']) + .to include('us-east-1') + end end end end From c79360d1409b1290ddbde53c7d5bab761be424bb Mon Sep 17 00:00:00 2001 From: Richard Wang Date: Wed, 21 Jan 2026 14:37:43 -0800 Subject: [PATCH 2/3] Update changelog --- gems/aws-sdk-sqs/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gems/aws-sdk-sqs/CHANGELOG.md b/gems/aws-sdk-sqs/CHANGELOG.md index 0b96787143a..a44f74b1bb7 100644 --- a/gems/aws-sdk-sqs/CHANGELOG.md +++ b/gems/aws-sdk-sqs/CHANGELOG.md @@ -1,7 +1,7 @@ Unreleased Changes ------------------ -* Feature - Support disabling queue url region detection. +* Feature - Support disabling queue url region detection through `disable_url_region_detection`. 1.110.0 (2026-01-16) ------------------ From 52659d58f80071dfe0a1643ae76bc40bbfc67bd4 Mon Sep 17 00:00:00 2001 From: Richard Wang Date: Thu, 22 Jan 2026 09:24:40 -0800 Subject: [PATCH 3/3] Change to disable_queue_url_region_detection --- gems/aws-sdk-sqs/CHANGELOG.md | 2 +- gems/aws-sdk-sqs/lib/aws-sdk-sqs/client.rb | 6 +++--- gems/aws-sdk-sqs/lib/aws-sdk-sqs/plugins/queue_urls.rb | 4 ++-- gems/aws-sdk-sqs/sig/client.rbs | 2 +- gems/aws-sdk-sqs/sig/resource.rbs | 2 +- gems/aws-sdk-sqs/spec/client/queue_urls_spec.rb | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gems/aws-sdk-sqs/CHANGELOG.md b/gems/aws-sdk-sqs/CHANGELOG.md index a44f74b1bb7..4a1ad06a755 100644 --- a/gems/aws-sdk-sqs/CHANGELOG.md +++ b/gems/aws-sdk-sqs/CHANGELOG.md @@ -1,7 +1,7 @@ Unreleased Changes ------------------ -* Feature - Support disabling queue url region detection through `disable_url_region_detection`. +* Feature - Support disabling queue url region detection through `disable_queue_url_region_detection`. 1.110.0 (2026-01-16) ------------------ diff --git a/gems/aws-sdk-sqs/lib/aws-sdk-sqs/client.rb b/gems/aws-sdk-sqs/lib/aws-sdk-sqs/client.rb index f728973e6e5..176b83479a9 100644 --- a/gems/aws-sdk-sqs/lib/aws-sdk-sqs/client.rb +++ b/gems/aws-sdk-sqs/lib/aws-sdk-sqs/client.rb @@ -213,13 +213,13 @@ class Client < Seahorse::Client::Base # @option options [Boolean] :disable_host_prefix_injection (false) # When `true`, the SDK will not prepend the modeled host prefix to the endpoint. # + # @option options [Boolean] :disable_queue_url_region_detection (false) + # When set to `true`, the region will not be extracted from a provided queue url. Defaults to `false`. + # # @option options [Boolean] :disable_request_compression (false) # When set to 'true' the request body will not be compressed # for supported operations. # - # @option options [Boolean] :disable_url_region_detection (false) - # When set to `true`, the region will not be extracted from a provided queue url. Defaults to `false`. - # # @option options [String, URI::HTTPS, URI::HTTP] :endpoint # Normally you should not configure the `:endpoint` option # directly. This is normally constructed from the `:region` diff --git a/gems/aws-sdk-sqs/lib/aws-sdk-sqs/plugins/queue_urls.rb b/gems/aws-sdk-sqs/lib/aws-sdk-sqs/plugins/queue_urls.rb index 187eee2f590..53ae871461c 100644 --- a/gems/aws-sdk-sqs/lib/aws-sdk-sqs/plugins/queue_urls.rb +++ b/gems/aws-sdk-sqs/lib/aws-sdk-sqs/plugins/queue_urls.rb @@ -11,7 +11,7 @@ class QueueUrls < Seahorse::Client::Plugin # When set to 'false', the signing region will be modified to use the region # extracted from a provided queue url if it differs from the configured region. option( - :disable_url_region_detection, + :disable_queue_url_region_detection, default: false, doc_type: 'Boolean', docstring: <<~DOCS) @@ -35,7 +35,7 @@ def update_endpoint(context, url) # If the region in the queue url is not the configured # region, then we will modify signing to use it def update_region(context, queue_url) - return if context.config.disable_url_region_detection + return if context.config.disable_queue_url_region_detection if (queue_region = parse_region(queue_url)) && queue_region != context.config.region diff --git a/gems/aws-sdk-sqs/sig/client.rbs b/gems/aws-sdk-sqs/sig/client.rbs index b8f9a872d0d..61c448fc128 100644 --- a/gems/aws-sdk-sqs/sig/client.rbs +++ b/gems/aws-sdk-sqs/sig/client.rbs @@ -28,8 +28,8 @@ module Aws ?correct_clock_skew: bool, ?defaults_mode: String, ?disable_host_prefix_injection: bool, + ?disable_queue_url_region_detection: bool, ?disable_request_compression: bool, - ?disable_url_region_detection: bool, ?endpoint: String, ?endpoint_cache_max_entries: Integer, ?endpoint_cache_max_threads: Integer, diff --git a/gems/aws-sdk-sqs/sig/resource.rbs b/gems/aws-sdk-sqs/sig/resource.rbs index 96ba1fe7738..8967dace810 100644 --- a/gems/aws-sdk-sqs/sig/resource.rbs +++ b/gems/aws-sdk-sqs/sig/resource.rbs @@ -28,8 +28,8 @@ module Aws ?correct_clock_skew: bool, ?defaults_mode: String, ?disable_host_prefix_injection: bool, + ?disable_queue_url_region_detection: bool, ?disable_request_compression: bool, - ?disable_url_region_detection: bool, ?endpoint: String, ?endpoint_cache_max_entries: Integer, ?endpoint_cache_max_threads: Integer, diff --git a/gems/aws-sdk-sqs/spec/client/queue_urls_spec.rb b/gems/aws-sdk-sqs/spec/client/queue_urls_spec.rb index a3dbd22035e..de530806694 100644 --- a/gems/aws-sdk-sqs/spec/client/queue_urls_spec.rb +++ b/gems/aws-sdk-sqs/spec/client/queue_urls_spec.rb @@ -82,12 +82,12 @@ module SQS .to include('us-west-2') end - it 'disables region detection when disable_url_region_detection is true' do + it 'disables region detection when disable_queue_url_region_detection is true' do url = 'https://sqs.us-west-2.amazonaws.com/1234567890/demo' client = Client.new( stub_responses: true, region: 'us-east-1', - disable_url_region_detection: true + disable_queue_url_region_detection: true ) resp = client.send(method, params.merge(queue_url: url)) expect(resp.context.http_request.headers['authorization']) @@ -101,7 +101,7 @@ module SQS client = Client.new( stub_responses: true, region: 'us-east-1', - disable_url_region_detection: true + disable_queue_url_region_detection: true ) resp = client.send(method, params.merge(queue_url: url)) expect(resp.context.http_request.headers['authorization'])