pub struct ProxyConfig {
pub enabled: bool,
pub target_url: Option<String>,
pub timeout_seconds: u64,
pub follow_redirects: bool,
pub headers: HashMap<String, String>,
pub prefix: Option<String>,
pub passthrough_by_default: bool,
pub rules: Vec<ProxyRule>,
pub migration_enabled: bool,
pub migration_groups: HashMap<String, MigrationMode>,
pub request_replacements: Vec<BodyTransformRule>,
pub response_replacements: Vec<BodyTransformRule>,
}Expand description
Configuration for proxy behavior
Fields§
§enabled: boolWhether the proxy is enabled
target_url: Option<String>Target URL to proxy requests to
timeout_seconds: u64Timeout for proxy requests in seconds
follow_redirects: boolWhether to follow redirects
headers: HashMap<String, String>Additional headers to add to proxied requests
prefix: Option<String>Proxy prefix to strip from paths
passthrough_by_default: boolWhether to proxy by default
rules: Vec<ProxyRule>Proxy rules
migration_enabled: boolWhether migration features are enabled
migration_groups: HashMap<String, MigrationMode>Group-level migration mode overrides Maps group name to migration mode
request_replacements: Vec<BodyTransformRule>Request body replacement rules for browser proxy mode
response_replacements: Vec<BodyTransformRule>Response body replacement rules for browser proxy mode
Implementations§
Source§impl ProxyConfig
impl ProxyConfig
Sourcepub fn new(upstream_url: String) -> ProxyConfig
pub fn new(upstream_url: String) -> ProxyConfig
Create a new proxy configuration
Sourcepub fn get_effective_migration_mode(&self, path: &str) -> Option<MigrationMode>
pub fn get_effective_migration_mode(&self, path: &str) -> Option<MigrationMode>
Get the effective migration mode for a path Checks group overrides first, then route-specific mode
Sourcepub fn should_proxy(&self, _method: &Method, path: &str) -> bool
pub fn should_proxy(&self, _method: &Method, path: &str) -> bool
Check if a request should be proxied Respects migration mode: mock forces mock, real forces proxy, shadow forces proxy, auto uses existing logic This is a legacy method that doesn’t evaluate conditions - use should_proxy_with_condition for conditional proxying
Sourcepub fn should_proxy_with_condition(
&self,
method: &Method,
uri: &Uri,
headers: &HeaderMap,
body: Option<&[u8]>,
) -> bool
pub fn should_proxy_with_condition( &self, method: &Method, uri: &Uri, headers: &HeaderMap, body: Option<&[u8]>, ) -> bool
Check if a request should be proxied with conditional evaluation This method evaluates conditions in proxy rules using request context
Sourcepub fn should_shadow(&self, path: &str) -> bool
pub fn should_shadow(&self, path: &str) -> bool
Check if a route should use shadow mode (proxy + generate mock)
Sourcepub fn get_upstream_url(&self, path: &str) -> String
pub fn get_upstream_url(&self, path: &str) -> String
Get the upstream URL for a specific path
Sourcepub fn strip_prefix(&self, path: &str) -> String
pub fn strip_prefix(&self, path: &str) -> String
Strip the proxy prefix from a path
Sourcepub fn update_rule_migration_mode(
&mut self,
pattern: &str,
mode: MigrationMode,
) -> bool
pub fn update_rule_migration_mode( &mut self, pattern: &str, mode: MigrationMode, ) -> bool
Update migration mode for a specific route pattern Returns true if the rule was found and updated
Sourcepub fn update_group_migration_mode(&mut self, group: &str, mode: MigrationMode)
pub fn update_group_migration_mode(&mut self, group: &str, mode: MigrationMode)
Update migration mode for an entire group This affects all routes that belong to the group
Sourcepub fn toggle_route_migration(&mut self, pattern: &str) -> Option<MigrationMode>
pub fn toggle_route_migration(&mut self, pattern: &str) -> Option<MigrationMode>
Toggle a route’s migration mode through the stages: mock → shadow → real → mock Returns the new mode if the rule was found
Sourcepub fn toggle_group_migration(&mut self, group: &str) -> MigrationMode
pub fn toggle_group_migration(&mut self, group: &str) -> MigrationMode
Toggle a group’s migration mode through the stages: mock → shadow → real → mock Returns the new mode
Sourcepub fn get_migration_routes(&self) -> Vec<MigrationRouteInfo>
pub fn get_migration_routes(&self) -> Vec<MigrationRouteInfo>
Get all routes with their migration status
Sourcepub fn get_migration_groups(&self) -> HashMap<String, MigrationGroupInfo>
pub fn get_migration_groups(&self) -> HashMap<String, MigrationGroupInfo>
Get all migration groups with their status
Trait Implementations§
Source§impl Clone for ProxyConfig
impl Clone for ProxyConfig
Source§fn clone(&self) -> ProxyConfig
fn clone(&self) -> ProxyConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more