Class HTTPMatchRequest
HttpMatchRequest specifies a set of criterion to be met in order for the rule to be applied to the HTTP request. For example, the following restricts the rule to match only requests where the URL path starts with /ratings/v2/ and the request contains a custom end-user header with value jason.
Namespace: Neon.Kube.Resources.Istio
Assembly: Neon.Kube.Resources.dll
Syntax
public class HTTPMatchRequest
Constructors
HTTPMatchRequest()
Initializes a new instance of the HTTPMatchRequest class.
Declaration
public HTTPMatchRequest()
Properties
Authority
URI Authority values are case-sensitive and formatted as follows:
exact: "value" for exact string match
prefix: "value" for prefix-based match
regex: "value" for RE2 style regex-based match(https://github.com/google/re2/wiki/Syntax).
Declaration
[JsonProperty(PropertyName = "authority", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public StringMatch Authority { get; set; }
Property Value
Type | Description |
---|---|
StringMatch |
Remarks
Note: Case-insensitive matching could be enabled via the ignore_uri_case flag.
Gateways
Names of gateways where the rule should be applied. Gateway names in the top-level gateways field of the V1VirtualService (if any) are overridden. The gateway match is independent of sourceLabels.
Declaration
[JsonProperty(PropertyName = "gateways", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public List<string> Gateways { get; set; }
Property Value
Type | Description |
---|---|
List<string> |
Headers
The header keys must be lowercase and use hyphen as the separator, e.g. x-request-id.
exact: "value" for exact string match
prefix: "value" for prefix-based match
regex: "value" for RE2 style regex-based match(https://github.com/google/re2/wiki/Syntax).
If the value is empty and only the name of header is specfied, presence of the header is checked. Note: The keys uri, scheme, method, and authority will be ignored.
Declaration
[JsonProperty(PropertyName = "headers", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public Dictionary<string, StringMatch> Headers { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, StringMatch> |
Remarks
Note: Case-insensitive matching could be enabled via the ignore_uri_case flag.
IgnoreUriCase
Flag to specify whether the URI matching should be case-insensitive.
Declaration
[JsonProperty(PropertyName = "ignoreUriCase", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public bool? IgnoreUriCase { get; set; }
Property Value
Type | Description |
---|---|
bool? |
Remarks
Note: The case will be ignored only in the case of exact and prefix URI matches.
Method
HTTP Method values are case-sensitive and formatted as follows:
exact: "value" for exact string match
prefix: "value" for prefix-based match
regex: "value" for RE2 style regex-based match(https://github.com/google/re2/wiki/Syntax).
Declaration
[JsonProperty(PropertyName = "method", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public StringMatch Method { get; set; }
Property Value
Type | Description |
---|---|
StringMatch |
Remarks
Note: Case-insensitive matching could be enabled via the ignore_uri_case flag.
Name
The name assigned to a match. The match’s name will be concatenated with the parent route’s name and will be logged in the access logs for requests matching this route.
Declaration
[JsonProperty(PropertyName = "name", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Port
Specifies the ports on the host that is being addressed. Many services only expose a single port or label ports with the protocols they support, in these cases it is not required to explicitly select the port.
Declaration
[JsonProperty(PropertyName = "port", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public int? Port { get; set; }
Property Value
Type | Description |
---|---|
int? |
QueryParameters
Query parameters for matching.
Ex:
For a query parameter like “?key=true”, the map key would be “key” and the string match could be defined as exact: "true".
For a query parameter like “?key”, the map key would be “key” and the string match could be defined as exact: "".
For a query parameter like “?key=123”, the map key would be “key” and the string match could be defined as regex: "\d+$". Note that this configuration will only match values like “123” but not “a123” or “123a”.
Declaration
[JsonProperty(PropertyName = "queryParams", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public Dictionary<string, StringMatch> QueryParameters { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, StringMatch> |
Remarks
Note: prefix matching is currently not supported.
Scheme
URI Scheme values are case-sensitive and formatted as follows:
exact: "value" for exact string match
prefix: "value" for prefix-based match
regex: "value" for RE2 style regex-based match(https://github.com/google/re2/wiki/Syntax).
Declaration
[JsonProperty(PropertyName = "scheme", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public StringMatch Scheme { get; set; }
Property Value
Type | Description |
---|---|
StringMatch |
Remarks
Note: Case-insensitive matching could be enabled via the ignore_uri_case flag.
SourceLabels
One or more labels that constrain the applicability of a rule to source (client) workloads with the given labels. If the V1VirtualService has a list of gateways specified in the top-level gateways field, it must include the reserved gateway mesh for this field to be applicable.
Declaration
[JsonProperty(PropertyName = "sourceLabels", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public Dictionary<string, string> SourceLabels { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, string> |
SourceNamespace
Source namespace constraining the applicability of a rule to workloads in that namespace. If the V1VirtualService has a list of gateways specified in the top-level gateways field, it must include the reserved gateway mesh for this field to be applicable.
Declaration
[JsonProperty(PropertyName = "sourceNamespace", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public string SourceNamespace { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
Note: Case-insensitive matching could be enabled via the ignore_uri_case flag.
Uri
URI to match values are case-sensitive and formatted as follows:
exact: "value" for exact string match
prefix: "value" for prefix-based match
regex: "value" for RE2 style regex-based match(https://github.com/google/re2/wiki/Syntax).
Declaration
[JsonProperty(PropertyName = "uri", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public StringMatch Uri { get; set; }
Property Value
Type | Description |
---|---|
StringMatch |
Remarks
Note: Case-insensitive matching could be enabled via the ignore_uri_case flag.
WithoutHeaders
withoutHeader has the same syntax with the header, but has opposite meaning. If a header is matched with a matching rule among withoutHeader, the traffic becomes not matched one.
Declaration
[JsonProperty(PropertyName = "withoutHeaders", Required = Required.Default, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public Dictionary<string, StringMatch> WithoutHeaders { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, StringMatch> |
Remarks
Note: Case-insensitive matching could be enabled via the ignore_uri_case flag.
Methods
Validate()
Validate the object.
Declaration
public virtual void Validate()
Exceptions
Type | Condition |
---|---|
ValidationException | Thrown if validation fails. |