MiddlewareHeaders

Struct MiddlewareHeaders 

Source
pub struct MiddlewareHeaders {
Show 33 fields pub access_control_allow_credentials: Option<bool>, pub access_control_allow_headers: Option<Vec<String>>, pub access_control_allow_methods: Option<Vec<String>>, pub access_control_allow_origin_list: Option<Vec<String>>, pub access_control_allow_origin_list_regex: Option<Vec<String>>, pub access_control_expose_headers: Option<Vec<String>>, pub access_control_max_age: Option<i64>, pub add_vary_header: Option<bool>, pub allowed_hosts: Option<Vec<String>>, pub browser_xss_filter: Option<bool>, pub content_security_policy: Option<String>, pub content_security_policy_report_only: Option<String>, pub content_type_nosniff: Option<bool>, pub custom_browser_xss_value: Option<String>, pub custom_frame_options_value: Option<String>, pub custom_request_headers: Option<BTreeMap<String, String>>, pub custom_response_headers: Option<BTreeMap<String, String>>, pub feature_policy: Option<String>, pub force_sts_header: Option<bool>, pub frame_deny: Option<bool>, pub hosts_proxy_headers: Option<Vec<String>>, pub is_development: Option<bool>, pub permissions_policy: Option<String>, pub public_key: Option<String>, pub referrer_policy: Option<String>, pub ssl_force_host: Option<bool>, pub ssl_host: Option<String>, pub ssl_proxy_headers: Option<BTreeMap<String, String>>, pub ssl_redirect: Option<bool>, pub ssl_temporary_redirect: Option<bool>, pub sts_include_subdomains: Option<bool>, pub sts_preload: Option<bool>, pub sts_seconds: Option<i64>,
}
Expand description

Headers holds the headers middleware configuration. This middleware manages the requests and responses headers. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/headers/#customrequestheaders

Fields§

§access_control_allow_credentials: Option<bool>

AccessControlAllowCredentials defines whether the request can include user credentials.

§access_control_allow_headers: Option<Vec<String>>

AccessControlAllowHeaders defines the Access-Control-Request-Headers values sent in preflight response.

§access_control_allow_methods: Option<Vec<String>>

AccessControlAllowMethods defines the Access-Control-Request-Method values sent in preflight response.

§access_control_allow_origin_list: Option<Vec<String>>

AccessControlAllowOriginList is a list of allowable origins. Can also be a wildcard origin “*”.

§access_control_allow_origin_list_regex: Option<Vec<String>>

AccessControlAllowOriginListRegex is a list of allowable origins written following the Regular Expression syntax (https://golang.org/pkg/regexp/).

§access_control_expose_headers: Option<Vec<String>>

AccessControlExposeHeaders defines the Access-Control-Expose-Headers values sent in preflight response.

§access_control_max_age: Option<i64>

AccessControlMaxAge defines the time that a preflight request may be cached.

§add_vary_header: Option<bool>

AddVaryHeader defines whether the Vary header is automatically added/updated when the AccessControlAllowOriginList is set.

§allowed_hosts: Option<Vec<String>>

AllowedHosts defines the fully qualified list of allowed domain names.

§browser_xss_filter: Option<bool>

BrowserXSSFilter defines whether to add the X-XSS-Protection header with the value 1; mode=block.

§content_security_policy: Option<String>

ContentSecurityPolicy defines the Content-Security-Policy header value.

§content_security_policy_report_only: Option<String>

ContentSecurityPolicyReportOnly defines the Content-Security-Policy-Report-Only header value.

§content_type_nosniff: Option<bool>

ContentTypeNosniff defines whether to add the X-Content-Type-Options header with the nosniff value.

§custom_browser_xss_value: Option<String>

CustomBrowserXSSValue defines the X-XSS-Protection header value. This overrides the BrowserXssFilter option.

§custom_frame_options_value: Option<String>

CustomFrameOptionsValue defines the X-Frame-Options header value. This overrides the FrameDeny option.

§custom_request_headers: Option<BTreeMap<String, String>>

CustomRequestHeaders defines the header names and values to apply to the request.

§custom_response_headers: Option<BTreeMap<String, String>>

CustomResponseHeaders defines the header names and values to apply to the response.

§feature_policy: Option<String>

Deprecated: FeaturePolicy option is deprecated, please use PermissionsPolicy instead.

§force_sts_header: Option<bool>

ForceSTSHeader defines whether to add the STS header even when the connection is HTTP.

§frame_deny: Option<bool>

FrameDeny defines whether to add the X-Frame-Options header with the DENY value.

§hosts_proxy_headers: Option<Vec<String>>

HostsProxyHeaders defines the header keys that may hold a proxied hostname value for the request.

§is_development: Option<bool>

IsDevelopment defines whether to mitigate the unwanted effects of the AllowedHosts, SSL, and STS options when developing. Usually testing takes place using HTTP, not HTTPS, and on localhost, not your production domain. If you would like your development environment to mimic production with complete Host blocking, SSL redirects, and STS headers, leave this as false.

§permissions_policy: Option<String>

PermissionsPolicy defines the Permissions-Policy header value. This allows sites to control browser features.

§public_key: Option<String>

PublicKey is the public key that implements HPKP to prevent MITM attacks with forged certificates.

§referrer_policy: Option<String>

ReferrerPolicy defines the Referrer-Policy header value. This allows sites to control whether browsers forward the Referer header to other sites.

§ssl_force_host: Option<bool>

Deprecated: SSLForceHost option is deprecated, please use RedirectRegex instead.

§ssl_host: Option<String>

Deprecated: SSLHost option is deprecated, please use RedirectRegex instead.

§ssl_proxy_headers: Option<BTreeMap<String, String>>

SSLProxyHeaders defines the header keys with associated values that would indicate a valid HTTPS request. It can be useful when using other proxies (example: “X-Forwarded-Proto”: “https”).

§ssl_redirect: Option<bool>

Deprecated: SSLRedirect option is deprecated, please use EntryPoint redirection or RedirectScheme instead.

§ssl_temporary_redirect: Option<bool>

Deprecated: SSLTemporaryRedirect option is deprecated, please use EntryPoint redirection or RedirectScheme instead.

§sts_include_subdomains: Option<bool>

STSIncludeSubdomains defines whether the includeSubDomains directive is appended to the Strict-Transport-Security header.

§sts_preload: Option<bool>

STSPreload defines whether the preload flag is appended to the Strict-Transport-Security header.

§sts_seconds: Option<i64>

STSSeconds defines the max-age of the Strict-Transport-Security header. If set to 0, the header is not set.

Implementations§

Source§

impl MiddlewareHeaders

Source

pub fn builder() -> MiddlewareHeadersBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>

Create a builder for building MiddlewareHeaders. On the builder, call .access_control_allow_credentials(...)(optional), .access_control_allow_headers(...)(optional), .access_control_allow_methods(...)(optional), .access_control_allow_origin_list(...)(optional), .access_control_allow_origin_list_regex(...)(optional), .access_control_expose_headers(...)(optional), .access_control_max_age(...)(optional), .add_vary_header(...)(optional), .allowed_hosts(...)(optional), .browser_xss_filter(...)(optional), .content_security_policy(...)(optional), .content_security_policy_report_only(...)(optional), .content_type_nosniff(...)(optional), .custom_browser_xss_value(...)(optional), .custom_frame_options_value(...)(optional), .custom_request_headers(...)(optional), .custom_response_headers(...)(optional), .feature_policy(...)(optional), .force_sts_header(...)(optional), .frame_deny(...)(optional), .hosts_proxy_headers(...)(optional), .is_development(...)(optional), .permissions_policy(...)(optional), .public_key(...)(optional), .referrer_policy(...)(optional), .ssl_force_host(...)(optional), .ssl_host(...)(optional), .ssl_proxy_headers(...)(optional), .ssl_redirect(...)(optional), .ssl_temporary_redirect(...)(optional), .sts_include_subdomains(...)(optional), .sts_preload(...)(optional), .sts_seconds(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of MiddlewareHeaders.

Trait Implementations§

Source§

impl Clone for MiddlewareHeaders

Source§

fn clone(&self) -> MiddlewareHeaders

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MiddlewareHeaders

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MiddlewareHeaders

Source§

fn default() -> MiddlewareHeaders

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for MiddlewareHeaders

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for MiddlewareHeaders

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for MiddlewareHeaders

Source§

fn eq(&self, other: &MiddlewareHeaders) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for MiddlewareHeaders

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MiddlewareHeaders

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,