Skip to content

allow routing sdk traffic through stable envd.<domain> host#2540

Open
matthewlouisbrockman wants to merge 6 commits intomainfrom
feat/enable-envd-connection
Open

allow routing sdk traffic through stable envd.<domain> host#2540
matthewlouisbrockman wants to merge 6 commits intomainfrom
feat/enable-envd-connection

Conversation

@matthewlouisbrockman
Copy link
Copy Markdown
Contributor

removes the env.islocal() flag from the envd.domain header parsing to allow passing sandbox id and port as headers. client proxy resolves it, then forwards to the orchestrators using the original host format. allows deploying client proxies without redeploying the orchestrators. allows http2 connections to the load balancers to more easily reuse the connection pools and mitigate resource exhaustion on the client.

@cursor
Copy link
Copy Markdown

cursor Bot commented May 2, 2026

PR Summary

Medium Risk
Medium risk because it changes request routing source-of-truth (host vs headers) and adds host-masking logic, which could misroute traffic or weaken host-based protections if the header gating is incorrect.

Overview
This PR enables routing requests through a stable envd.<domain> (and localhost) endpoint by adding an explicit header-routing mode to GetTargetFromRequest, parsing E2b-Sandbox-Id/E2b-Sandbox-Port only on those shared hosts when present, and disabling header routing in the orchestrator. The client proxy now optionally rewrites the upstream Host to the sandbox-style port-sandboxID.<domain> when entering via the shared host so the orchestrator continues to see the expected host format.

Reviewed by Cursor Bugbot for commit 650ea47. Bugbot is set up for automated code reviews on this repo. Configure here.

@matthewlouisbrockman matthewlouisbrockman force-pushed the feat/enable-envd-connection branch from 360075a to 261d28e Compare May 2, 2026 00:27
@matthewlouisbrockman matthewlouisbrockman marked this pull request as ready for review May 2, 2026 00:39
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit af62891. Configure here.

Comment thread packages/client-proxy/internal/proxy/proxy.go
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af62891747

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/client-proxy/internal/proxy/proxy.go
Comment thread packages/shared/pkg/proxy/host_test.go Outdated
Comment thread packages/client-proxy/internal/proxy/proxy.go
return &orchestratorHost
}

domain, ok := strings.CutPrefix(hostname, "envd.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lets put the envd subdomain to a const

return nil
}

orchestratorHost := fmt.Sprintf("%d-%s.%s", port, sandboxID, domain)
Copy link
Copy Markdown
Contributor

@dobrac dobrac May 2, 2026

Choose a reason for hiding this comment

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

for envd, we don't need to have the port configurable

so I would either fix the port to specific one, or change the general url

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.

4 participants