pub struct ProxyRewriteBuilder {
pub uri: Option<String>,
pub method: Option<ProxyRewriteMethod>,
pub regex_uri: Option<Vec<String>>,
pub host: Option<String>,
pub use_real_request_uri_unsafe: Option<bool>,
pub headers: Option<ProxyRewriteHeaders>,
}Expand description
Builder pattern to create a ProxyRewrite
Fields§
§uri: Option<String>§method: Option<ProxyRewriteMethod>§regex_uri: Option<Vec<String>>§host: Option<String>§use_real_request_uri_unsafe: Option<bool>§headers: Option<ProxyRewriteHeaders>Implementations§
Source§impl ProxyRewriteBuilder
impl ProxyRewriteBuilder
pub fn new() -> Self
Sourcepub fn with_uri(self, uri: impl Into<String>) -> Self
pub fn with_uri(self, uri: impl Into<String>) -> Self
New Upstream forwarding address. Value supports Nginx variables.
Example, $arg_name
Sourcepub fn with_method(self, method: ProxyRewriteMethod) -> Self
pub fn with_method(self, method: ProxyRewriteMethod) -> Self
Rewrites the HTTP method
Sourcepub fn with_regex_uri(self, regex_uri: Vec<String>) -> Self
pub fn with_regex_uri(self, regex_uri: Vec<String>) -> Self
Regular expressions can be used to match the URL from client. If it matches, the URL template is forwarded to the upstream. Otherwise, the URL from the client is forwarded. When both uri and regex_uri are configured, uri has a higher priority. Multiple regular expressions are currently supported for pattern matching, and the plugin will try to match them one by one until they succeed or all fail.
For example: [“^/iresty/(. *)/(. *)/(. *)”, “/$1-$2-$3”, ^/theothers/(. *)/(. *)“, “/theothers/$1-$2”], the element with the odd index represents the uri regular expression that matches the request from the client, and the element with the even index represents the uri template that is forwarded upstream upon a successful match. Please note that the length of this value must be an even number.
Sourcepub fn with_use_real_request_uri_unsafe(
self,
use_real_request_uri_unsafe: bool,
) -> Self
pub fn with_use_real_request_uri_unsafe( self, use_real_request_uri_unsafe: bool, ) -> Self
Use real_request_uri (original $request_uri in nginx) to bypass URI normalization. Enabling this is considered unsafe as it bypasses all URI normalization steps.
pub fn with_headers(self, headers: ProxyRewriteHeaders) -> Self
Sourcepub fn build(self) -> Result<ProxyRewrite, ApisixClientError>
pub fn build(self) -> Result<ProxyRewrite, ApisixClientError>
Header manipulator
Trait Implementations§
Source§impl Clone for ProxyRewriteBuilder
impl Clone for ProxyRewriteBuilder
Source§fn clone(&self) -> ProxyRewriteBuilder
fn clone(&self) -> ProxyRewriteBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more