-
Notifications
You must be signed in to change notification settings - Fork 9
feat(proxy): support Claude Code subscription traffic #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7b784f2
e08e08a
9eca034
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -434,6 +434,18 @@ type ServerConfig struct { | |
| // EnabledPassthroughProviders lists the provider types enabled on | ||
| // /p/{provider}/... passthrough routes. Default: ["openai", "anthropic"]. | ||
| EnabledPassthroughProviders []string `yaml:"enabled_passthrough_providers" env:"ENABLED_PASSTHROUGH_PROVIDERS"` | ||
| // ExperimentalForwardProxyEnabled enables an HTTP forward proxy entrypoint that can | ||
| // optionally MITM selected HTTPS hosts for traffic inspection. Default: false. | ||
| ExperimentalForwardProxyEnabled bool `yaml:"experimental_forward_proxy_enabled" env:"EXPERIMENTAL_FORWARD_PROXY_ENABLED"` | ||
| // ExperimentalForwardProxyMITMHosts lists the hosts whose HTTPS CONNECT traffic | ||
| // should be terminated and inspected. Other hosts are tunneled blindly. | ||
| ExperimentalForwardProxyMITMHosts []string `yaml:"experimental_forward_proxy_mitm_hosts" env:"EXPERIMENTAL_FORWARD_PROXY_MITM_HOSTS"` | ||
| // ExperimentalForwardProxyCACertFile points at the PEM-encoded CA certificate used | ||
| // to mint leaf certificates for inspected HTTPS hosts. | ||
| ExperimentalForwardProxyCACertFile string `yaml:"experimental_forward_proxy_ca_cert_file" env:"EXPERIMENTAL_FORWARD_PROXY_CA_CERT_FILE"` | ||
| // ExperimentalForwardProxyCAKeyFile points at the PEM-encoded CA private key used | ||
| // to mint leaf certificates for inspected HTTPS hosts. | ||
| ExperimentalForwardProxyCAKeyFile string `yaml:"experimental_forward_proxy_ca_key_file" env:"EXPERIMENTAL_FORWARD_PROXY_CA_KEY_FILE"` | ||
|
Comment on lines
+437
to
+448
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default MITM host + empty CA paths creates a brittle enabled state. With Line 431 defaulting 🛠️ Proposed fix func Load() (*LoadResult, error) {
...
+ if cfg.Server.ExperimentalForwardProxyEnabled &&
+ len(cfg.Server.ExperimentalForwardProxyMITMHosts) > 0 &&
+ (strings.TrimSpace(cfg.Server.ExperimentalForwardProxyCACertFile) == "" ||
+ strings.TrimSpace(cfg.Server.ExperimentalForwardProxyCAKeyFile) == "") {
+ return nil, fmt.Errorf("experimental forward proxy MITM requires both EXPERIMENTAL_FORWARD_PROXY_CA_CERT_FILE and EXPERIMENTAL_FORWARD_PROXY_CA_KEY_FILE")
+ }
...
}Alternative: set default Also applies to: 431-431 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| // MetricsConfig holds observability configuration for Prometheus metrics | ||
|
|
@@ -504,6 +516,7 @@ func buildDefaultConfig() *Config { | |
| "openai", | ||
| "anthropic", | ||
| }, | ||
| ExperimentalForwardProxyMITMHosts: []string{"api.anthropic.com"}, | ||
| }, | ||
| Cache: CacheConfig{ | ||
| Model: ModelCacheConfig{ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Add CA file env vars to the key-settings table for parity.
The paragraph on Line 182 mentions
EXPERIMENTAL_FORWARD_PROXY_CA_CERT_FILEandEXPERIMENTAL_FORWARD_PROXY_CA_KEY_FILE, but they are not listed in the table. Adding them there improves discoverability.Also applies to: 182-182
🤖 Prompt for AI Agents