Skip to content

Resolve host prefix injection setting from env/config - #7496

Open
alextwoods wants to merge 2 commits into
masterfrom
alexwoo/host-prefix-injection-config
Open

alextwoods wants to merge 2 commits into
masterfrom
alexwoo/host-prefix-injection-config

Conversation

@alextwoods

Copy link
Copy Markdown
Contributor

Motivation

The DISABLE_HOST_PREFIX_INJECTION advanced option could only be set in code, and the AWS client builder set it to false whenever the caller left it unset. The SDK read no system property, environment variable or profile setting for it. Those are supported by the CLI and Boto3.

Changes

  1. Clients now resolve the option at build time when the caller has not set it in code, from the aws.disableHostPrefixInjection system property, then the AWS_DISABLE_HOST_PREFIX_INJECTION environment variable, then the disable_host_prefix_injection profile property, and then false.
  2. The AWS client builder no longer forces the option to false, which blocked this resolution.
  3. A value set in code through overrideConfiguration still takes precedence over all three sources.
  4. The option's javadoc lists the sources and their order, and a changelog entry announces the feature.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

License

  • I confirm that this pull request can be released under the Apache 2 license

## Motivation

The `DISABLE_HOST_PREFIX_INJECTION` advanced option could only be set in code, and the AWS client builder set it to false whenever the caller left it unset. The SDK read no system property, environment variable or profile setting for it. A user who started the JVM with `-Daws.disableHostPrefixInjection=true` still had requests sent to the prefixed host, such as `data-servicediscovery.us-east-1.amazonaws.com`.

## Changes

1. Clients now resolve the option at build time when the caller has not set it in code, from the `aws.disableHostPrefixInjection` system property, then the `AWS_DISABLE_HOST_PREFIX_INJECTION` environment variable, then the `disable_host_prefix_injection` profile property, and then false.
2. The AWS client builder no longer forces the option to false, which blocked this resolution.
3. A value set in code through `overrideConfiguration` still takes precedence over all three sources.
4. The option's javadoc lists the sources and their order, and a changelog entry announces the feature.
@alextwoods
alextwoods requested a review from a team as a code owner October 29, 2026 20:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant