Skip to content

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

@hellocomrade

Description

@hellocomrade

Spring AI 2.0 M6 introduced the following change:

"Azure OpenAI functionality is now available through the standard spring-ai-openai module, which provides full Azure OpenAI deployment support."

However, this change does not appear to support a common enterprise deployment scenario where a proxy server sits between the application and Azure OpenAI.

Currently, Azure-specific behavior seems to be inferred from the target domain name. When requests are routed through an enterprise proxy whose hostname does not contain the expected Azure domain pattern, Spring AI does not apply Azure-specific request handling (such as deployment-based paths, query parameters, or headers). As a result, requests sent through the proxy fail, typically with HTTP 404 responses.

Expected Behavior

Azure OpenAI support should not rely solely on hostname/domain detection. It should be possible to explicitly configure Azure mode even when requests are routed through a non-Azure proxy endpoint.

Example Scenario

Application → Enterprise Proxy → Azure OpenAI

Example proxy endpoint:

https://llm-proxy.company.internal

Even though the backend target is Azure OpenAI, Spring AI treats the endpoint as a standard OpenAI-compatible API because the hostname is not an Azure domain.

Impact

This affects enterprise environments where:

outbound traffic must traverse API gateways or proxy servers
Azure OpenAI access is centralized behind internal infrastructure
applications are not allowed to directly access Azure endpoints
Suggested Improvement

Consider adding an explicit configuration option to force Azure OpenAI mode independently of endpoint hostname detection.

For example:

spring.ai.openai.azure.enabled=true

or a configurable API type/provider option similar to previous Azure-specific integrations.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions