# Compute V1 Client - Class HttpHeaderMatch (2.10.0)

2.10.0 (latest) 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.0.0 1.36.0 1.35.0 1.34.0 1.33.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 1.24.0 1.23.0 1.22.1 1.21.0 1.20.0 1.19.0 1.18.1 1.17.0 1.16.2 1.14.0 1.13.0 1.12.1 1.11.1 1.10.1 1.9.1 1.8.3 1.7.1 1.6.1 1.5.0 Reference documentation and code samples for the Compute V1 Client class HttpHeaderMatch.

matchRule criteria for request header matches.

Generated from protobuf message `google.cloud.compute.v1.HttpHeaderMatch`

## Namespace

Google \\ Cloud \\ Compute \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ exact_match` | `string` The value should exactly match contents of exactMatch. Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set. |
| `↳ header_name` | `string` The name of the HTTP header to match. For matching against the HTTP request's authority, use a headerMatch with the header name ":authority". For matching a request's method, use the headerName ":method". When the URL map is bound to a target gRPC proxy that has the validateForProxyless field set to true, only non-binary user-specified custom metadata and the `content-type` header are supported. The following transport-level headers cannot be used in header matching rules: `:authority`, `:method`, `:path`, `:scheme`, `user-agent`, `accept-encoding`, `content-encoding`, `grpc-accept-encoding`, `grpc-encoding`, `grpc-previous-rpc-attempts`, `grpc-tags-bin`, `grpc-timeout` and `grpc-trace-bin`. |
| `↳ invert_match` | `bool` If set to false, the headerMatch is considered a match if the preceding match criteria are met. If set to true, the headerMatch is considered a match if the preceding match criteria are NOT met. The default setting is false. |
| `↳ prefix_match` | `string` The value of the header must start with the contents ofprefixMatch. Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set. |
| `↳ present_match` | `bool` A header with the contents of headerName must exist. The match takes place whether or not the request's header has a value. Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set. |
| `↳ range_match` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.Int64RangeMatch` The header value must be an integer and its value must be in the range specified in rangeMatch. If the header does not contain an integer, number or is empty, the match fails. For example for a range \[-5, 0\] - -3 will match. - 0 will not match. - 0.25 will not match. - -3someString will not match. Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set. rangeMatch is not supported for load balancers that have loadBalancingScheme set to EXTERNAL. |
| `↳ regex_match` | `string` The value of the header must match the regular expression specified inregexMatch. For more information about regular expression syntax, see Syntax. For matching against a port specified in the HTTP request, use a headerMatch with headerName set to PORT and a regular expression that satisfies the RFC2616 Host header's port specifier. Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set. Regular expressions can only be used when the loadBalancingScheme is set to INTERNAL_SELF_MANAGED, EXTERNAL_MANAGED (regional scope) or INTERNAL_MANAGED. |
| `↳ suffix_match` | `string` The value of the header must end with the contents ofsuffixMatch. Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set. |

### getExactMatch

The value should exactly match contents of exactMatch.

Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasExactMatch

### clearExactMatch

### setExactMatch

The value should exactly match contents of exactMatch.

Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getHeaderName

The name of the HTTP header to match.

For matching against the HTTP request's authority, use a headerMatch
with the header name ":authority".
For matching a request's method, use the headerName ":method".
When the URL map is bound to a target gRPC proxy that has
the validateForProxyless field set to true, only
non-binary
user-specified custom metadata and the `content-type` header are supported.
The following transport-level headers cannot be used in header matching
rules:
`:authority`, `:method`, `:path`, `:scheme`, `user-agent`,
`accept-encoding`, `content-encoding`, `grpc-accept-encoding`,
`grpc-encoding`, `grpc-previous-rpc-attempts`, `grpc-tags-bin`,
`grpc-timeout` and `grpc-trace-bin`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasHeaderName

### clearHeaderName

### setHeaderName

The name of the HTTP header to match.

For matching against the HTTP request's authority, use a headerMatch
with the header name ":authority".
For matching a request's method, use the headerName ":method".
When the URL map is bound to a target gRPC proxy that has
the validateForProxyless field set to true, only
non-binary
user-specified custom metadata and the `content-type` header are supported.
The following transport-level headers cannot be used in header matching
rules:
`:authority`, `:method`, `:path`, `:scheme`, `user-agent`,
`accept-encoding`, `content-encoding`, `grpc-accept-encoding`,
`grpc-encoding`, `grpc-previous-rpc-attempts`, `grpc-tags-bin`,
`grpc-timeout` and `grpc-trace-bin`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getInvertMatch

If set to false, the headerMatch is considered a
match if the preceding match criteria are met. If set to true,
the headerMatch is considered a match if the preceding
match criteria are NOT met.

The default setting is false.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasInvertMatch

### clearInvertMatch

### setInvertMatch

If set to false, the headerMatch is considered a
match if the preceding match criteria are met. If set to true,
the headerMatch is considered a match if the preceding
match criteria are NOT met.

The default setting is false.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPrefixMatch

The value of the header must start with the contents ofprefixMatch.

Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasPrefixMatch

### clearPrefixMatch

### setPrefixMatch

The value of the header must start with the contents ofprefixMatch.

Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPresentMatch

A header with the contents of headerName must exist. The
match takes place whether or not the request's header has a value.

Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasPresentMatch

### clearPresentMatch

### setPresentMatch

A header with the contents of headerName must exist. The
match takes place whether or not the request's header has a value.

Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRangeMatch

The header value must be an integer and its value must be in the range
specified in rangeMatch. If the header does not contain an
integer, number or is empty, the match fails.

For example for a range \[-5, 0\]

- -3 will match.
- 0 will not match.
- 0.25 will not match.
- -3someString will not match. Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set. rangeMatch is not supported for load balancers that have loadBalancingScheme set to EXTERNAL.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.Int64RangeMatch|null` |   |

### hasRangeMatch

### clearRangeMatch

### setRangeMatch

The header value must be an integer and its value must be in the range
specified in rangeMatch. If the header does not contain an
integer, number or is empty, the match fails.

For example for a range \[-5, 0\]

- -3 will match.
- 0 will not match.
- 0.25 will not match.
- -3someString will not match. Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set. rangeMatch is not supported for load balancers that have loadBalancingScheme set to EXTERNAL.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.Int64RangeMatch` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRegexMatch

The value of the header must match the regular expression specified inregexMatch.

For more information about regular expression syntax, see Syntax.
For matching against a port specified in the HTTP request, use a
headerMatch with headerName set to PORT and a regular expression that
satisfies the RFC2616 Host header's port specifier.
Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.
Regular expressions can only be used when the loadBalancingScheme is
set to INTERNAL_SELF_MANAGED, EXTERNAL_MANAGED
(regional scope) or INTERNAL_MANAGED.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasRegexMatch

### clearRegexMatch

### setRegexMatch

The value of the header must match the regular expression specified inregexMatch.

For more information about regular expression syntax, see Syntax.
For matching against a port specified in the HTTP request, use a
headerMatch with headerName set to PORT and a regular expression that
satisfies the RFC2616 Host header's port specifier.
Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.
Regular expressions can only be used when the loadBalancingScheme is
set to INTERNAL_SELF_MANAGED, EXTERNAL_MANAGED
(regional scope) or INTERNAL_MANAGED.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSuffixMatch

The value of the header must end with the contents ofsuffixMatch.

Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasSuffixMatch

### clearSuffixMatch

### setSuffixMatch

The value of the header must end with the contents ofsuffixMatch.

Only one of exactMatch, prefixMatch,suffixMatch, regexMatch,presentMatch or rangeMatch must be set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |