Skip to content

Conversation

@wyf7107
Copy link
Collaborator

@wyf7107 wyf7107 commented Oct 30, 2025

Add support for reverse proxy in adk web, users can specify a optional param --root_path for the proxied path.

@wyf7107 wyf7107 requested a review from hangfei October 30, 2025 22:13
@gemini-code-assist
Copy link

Summary of Changes

Hello @wyf7107, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces crucial functionality for deploying the 'adk web' application in environments utilizing reverse proxies. By adding a '--root_path' parameter, the application can now correctly construct URLs for its backend services and manage UI redirects, ensuring seamless operation when accessed via a proxied path rather than directly from its root. This enhancement improves deployment flexibility and compatibility with various network architectures.

Highlights

  • Reverse Proxy Support: Implemented support for running 'adk web' behind a reverse proxy, enabling more flexible deployment options.
  • --root_path Parameter: Introduced an optional '--root_path' command-line argument, allowing users to specify the base path for proxied access.
  • Dynamic URL Generation: Configured the application to use the specified 'root_path' for generating 'backendUrl' in runtime configuration and for handling UI redirects, ensuring correct routing.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@adk-bot adk-bot added the web [Component] This issue will be transferred to adk-web label Oct 30, 2025
@adk-bot
Copy link
Collaborator

adk-bot commented Oct 30, 2025

Response from ADK Triaging Agent

Hello @wyf7107, thank you for creating this PR!

To help reviewers evaluate your contribution, could you please provide the following information as outlined in our contribution guidelines?

  • Associated Issue: Please link the GitHub issue that this PR addresses. If one doesn't exist, you can create one.
  • Testing Plan: Please add a testing plan section to your PR description explaining how you've tested these changes.
  • Unit Tests: Please provide a summary of the pytest results for any new or updated unit tests.
  • End-to-End (E2E) Tests: Please include screenshots or console output from your manual E2E tests using adk web.

Additionally, the pyink-check has failed. You can fix this by running the auto-formatter script:

./autoformat.sh

This information will help reviewers to review your PR more efficiently. Thanks!

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for running the ADK web server behind a reverse proxy by introducing a --root_path parameter. The changes correctly propagate this new parameter through the CLI, FastAPI app setup, and to the web server logic. My review includes a few suggestions to improve code style, type safety, and robustness in URL construction. Overall, the implementation is solid and addresses the feature requirement effectively.


devRedirectUrl = "/dev-ui/"
if self.root_path:
devRedirectUrl = self.root_path + "/dev-ui/"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current string concatenation for devRedirectUrl could result in a double slash (e.g., /proxy//dev-ui/) if self.root_path has a trailing slash. While many systems handle this, it's more robust to ensure a clean URL. Using rstrip('/') will prevent this issue.

Suggested change
devRedirectUrl = self.root_path + "/dev-ui/"
devRedirectUrl = self.root_path.rstrip("/") + "/dev-ui/"

@click.option(
"--root_path",
type=str,
default = None,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a minor style issue here. According to PEP 8, you should avoid extraneous whitespace around the = operator for keyword arguments.1

Suggested change
default = None,
default=None,

Style Guide References

Footnotes

  1. PEP 8 E251 recommends no space around the = sign for keyword arguments.

a2a: bool = False,
host: str = "127.0.0.1",
port: int = 8000,
root_path = None,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The root_path parameter is missing a type hint. For better code clarity and maintainability, please add the appropriate type hint. Based on its usage, it should be Optional[str].

Suggested change
root_path = None,
root_path: Optional[str] = None,

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

Labels

web [Component] This issue will be transferred to adk-web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants