pub trait LocationInstance: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn upstream(&self) -> &str;
fn rewrite(
&self,
header: &mut RequestHeader,
variables: Option<AHashMap<String, String>>,
) -> (bool, Option<AHashMap<String, String>>);
fn headers(&self) -> Option<&Vec<(HeaderName, HeaderValue, bool)>>;
fn client_body_size_limit(&self) -> usize;
fn on_request(&self) -> Result<(u64, i32)>;
fn on_response(&self);
}Expand description
Trait for location instance
Required Methods§
Sourcefn rewrite(
&self,
header: &mut RequestHeader,
variables: Option<AHashMap<String, String>>,
) -> (bool, Option<AHashMap<String, String>>)
fn rewrite( &self, header: &mut RequestHeader, variables: Option<AHashMap<String, String>>, ) -> (bool, Option<AHashMap<String, String>>)
Rewrite the request url
Sourcefn headers(&self) -> Option<&Vec<(HeaderName, HeaderValue, bool)>>
fn headers(&self) -> Option<&Vec<(HeaderName, HeaderValue, bool)>>
Returns the proxy header to upstream
Sourcefn client_body_size_limit(&self) -> usize
fn client_body_size_limit(&self) -> usize
Returns the client body size limit
Sourcefn on_request(&self) -> Result<(u64, i32)>
fn on_request(&self) -> Result<(u64, i32)>
Called when the request is received from the client
Returns
Result<(u64, i32)> - A tuple containing:
- The new total number of accepted requests (u64)
- The new number of currently processing requests (i32)
Sourcefn on_response(&self)
fn on_response(&self)
Called when the response is received from the upstream