Skip to content

Fix Microsoft Foundry URL path mode for proxy hosts#6180

Open
jewoodev wants to merge 1 commit into
spring-projects:mainfrom
jewoodev:fix/6060-azure-url-path-mode
Open

Fix Microsoft Foundry URL path mode for proxy hosts#6180
jewoodev wants to merge 1 commit into
spring-projects:mainfrom
jewoodev:fix/6060-azure-url-path-mode

Conversation

@jewoodev
Copy link
Copy Markdown
Contributor

@jewoodev jewoodev commented May 27, 2026

Why: When spring.ai.openai.microsoft-foundry=true is combined with an enterprise proxy base-url, embedding and chat requests miss the /openai/deployments/{deployment} path and the ?api-version=... query, returning 404. The openai-java SDK keeps AzureUrlPathMode.AUTO, which classifies hosts via an Azure-domain whitelist — proxy hosts fall through to NON_AZURE and the SDK skips Azure URL shaping, even when Spring AI has already resolved the provider as MICROSOFT_FOUNDRY.

How: This forwards that decision to the SDK: when the provider is MICROSOFT_FOUNDRY, the client builder is given AzureUrlPathMode.UNIFIED if the base URL ends with /openai/v1, and AzureUrlPathMode.LEGACY otherwise. The path mode is set before credential selection, so the same decision reaches every authentication path. Behavior worked in 1.1.0-M3 and regressed after the SDK migration.

Test: OpenAiSetupTests covers sync/async proxy hosts, the unified endpoint, an explicit Credential injection, and non-Foundry baselines (OpenAI and GitHub Models) that keep AUTO. Verified with ./mvnw package.

Closes #6060

Signed-off-by: jewoodev <jewoos15@naver.com>
@jewoodev jewoodev changed the title Propagate Microsoft Foundry to Azure URL path mode Fix Microsoft Foundry URL path mode for proxy hosts May 28, 2026
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.

Azure support on URI construction is limited if the service is provided through proxy

1 participant