Skip to content

feat: aws client supports proxy settings - #2107

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
wuhan005:wh/aws-client-support-proxy
Oct 28, 2025
Merged

seefs001 merged 1 commit into
QuantumNous:mainfrom
wuhan005:wh/aws-client-support-proxy

Conversation

@wuhan005

@wuhan005 wuhan005 commented Oct 27, 2025 •

Copy link
Copy Markdown
Contributor

Fix #998

Summary by CodeRabbit

  • New Features
    • Added support for configurable proxy in AWS connections. When a proxy is defined in channel settings, it will be automatically used for AWS service requests; otherwise, a default HTTP client is utilized.

@coderabbitai

coderabbitai Bot commented Oct 27, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The PR adds proxy-aware HTTP client configuration to the AWS Bedrock relay channel. When a proxy is defined in channel settings, a proxy HTTP client is created and passed to the bedrockruntime client; otherwise, a default HTTP client is used. Service package imports were added to support this functionality.

Changes

Cohort / File(s) Summary
AWS Bedrock proxy support
relay/channel/aws/relay-aws.go
Introduced configurable HTTP client creation: checks for proxy in info.ChannelSetting.Proxy; creates proxy HTTP client via service.NewProxyHttpClient if present, otherwise retrieves default via service.GetHttpClient; passes HTTPClient to bedrockruntime.New for both two-secret and three-secret AWS key configurations
Dependencies
go.mod
Updated to reflect new service package dependency

Sequence Diagram

sequenceDiagram
    participant Relay as AWS Relay
    participant Svc as Service
    participant Client as Bedrock Runtime
    
    Relay->>Relay: Check ChannelSetting.Proxy
    alt Proxy configured
        Relay->>Svc: NewProxyHttpClient(proxyURL)
        Svc-->>Relay: HTTPClient (proxy-aware)
    else No proxy
        Relay->>Svc: GetHttpClient()
        Svc-->>Relay: HTTPClient (default)
    end
    
    Relay->>Client: bedrockruntime.New(opts with HTTPClient)
    Client-->>Relay: Bedrock client instance
    Note over Client: Subsequent requests use<br/>configured HTTP client
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Key areas for review:
    • Verify proxy HTTP client creation and fallback logic are correct
    • Confirm HTTPClient option is properly passed in both AWS authentication paths (two-secret and three-secret)
    • Check that service package integration doesn't introduce circular dependencies
    • Validate that the proxy configuration field name matches channel settings schema

Possibly related PRs

  • feat: use proxy HTTP client fetch models #1584: Implements per-channel proxy-aware HTTP client wiring for another relay channel, following the same pattern of checking channel settings and creating/using proxy clients for outbound requests.

Poem

🐰 A tunnel through the firewall's wall,
Through proxy paths, AWS calls now crawl,
The bedrock shifts from direct to proxy way,
No more blocked by the distant bay! 🌐

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Linked Issues Check ❓ Inconclusive Issue #998 describes a problem where multiple channels (specifically AWS Bedrock and Alibaba/百炼) do not respect HTTP proxy settings, while OpenAI does. The expected outcome is that all channels accepting a "proxy" configuration should use the specified HTTP proxy. However, this PR specifically addresses only AWS Bedrock proxy support as evidenced by the title and the limited scope of changes to relay-aws.go. The issue description indicates both AWS and Alibaba channels need fixing, but this PR does not appear to address the Alibaba/百炼 channel requirements [#998]. To provide a definitive assessment, clarify whether this PR is intended as a complete fix for issue #998 or if Alibaba/百炼 proxy support is being addressed in a separate pull request. If this is intended as a complete fix, additional changes to the Alibaba/百炼 channel implementation would be needed to fully satisfy the linked issue requirements.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: aws client supports proxy settings" accurately and specifically describes the main change in the provided code. The title is concise at 6 words, avoids unnecessary noise, and clearly communicates that the feature adds proxy configuration support to the AWS client. The change summary confirms this is the primary modification—adding a configurable HTTP client that respects proxy settings in AWS Bedrock client creation.
Out of Scope Changes Check ✅ Passed The code changes are narrowly focused on the stated objective of adding proxy support to the AWS client. Modifications are limited to relay/channel/aws/relay-aws.go and involve adding proxy HTTP client configuration to AWS Bedrock client creation, with corresponding import updates. The changes introduce no unrelated modifications, maintain existing public API signatures, and directly implement proxy-aware HTTP client behavior as described in the PR objectives.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6791eb7 and 3dbe0c2.

📒 Files selected for processing (1)
  • relay/channel/aws/relay-aws.go (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
relay/channel/aws/relay-aws.go (1)
service/http_client.go (2)
  • NewProxyHttpClient (66-134)
  • GetHttpClient (49-51)
🔇 Additional comments (3)
relay/channel/aws/relay-aws.go (3)

15-15: LGTM! Import addition is necessary.

The service package import is required for the proxy HTTP client functionality introduced in this PR.


29-40: Excellent implementation of proxy support!

The HTTP client setup logic correctly:

  • Creates a proxy-aware client when a proxy is configured in channel settings
  • Falls back to the default configured client when no proxy is specified
  • Handles errors appropriately with descriptive error messages

This properly addresses the issue where AWS Bedrock channels were not respecting proxy settings.


51-51: HTTPClient properly configured for both authentication methods.

Both the bearer token (line 51) and credentials-based (line 60) authentication flows now use the configured HTTP client, ensuring proxy support works regardless of the AWS authentication method used.

To confirm that the proxy functionality works as expected with AWS Bedrock, please verify:

  1. Bearer token authentication with proxy configured routes through the proxy
  2. Credentials-based authentication with proxy configured routes through the proxy
  3. Without proxy configured, the default client is used

You can verify the proxy is being used by checking network traffic or proxy logs when making requests to AWS Bedrock.

Also applies to: 60-60


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@seefs001
seefs001 merged commit 39a4c9a into QuantumNous:main Oct 28, 2025
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
…rt-proxy

feat: aws client supports proxy settings
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
…rt-proxy

feat: aws client supports proxy settings
junjundesk pushed a commit to junjundesk/new-api that referenced this pull request Oct 3, 2026
…rt-proxy

feat: aws client supports proxy settings
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.

2 participants