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 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 moreSource§impl Debug for ProxyConfig
impl Debug for ProxyConfig
Source§impl Default for ProxyConfig
impl Default for ProxyConfig
Source§impl<'de> Deserialize<'de> for ProxyConfig
impl<'de> Deserialize<'de> for ProxyConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ProxyConfig
impl JsonSchema for ProxyConfig
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for ProxyConfig
impl RefUnwindSafe for ProxyConfig
impl Send for ProxyConfig
impl Sync for ProxyConfig
impl Unpin for ProxyConfig
impl UnwindSafe for ProxyConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more