---
title: http_status_matches
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/miscellaneous/http-status-matches
---

```
BOOL http_status_matches(INTEGER status, STRING fmt)
```

**Available in:** all subroutines

Determines whether the HTTP status matches or does not match any of the 
statuses in the supplied `fmt` string. 

Returns `true` when the `status` matches any of the strings and returns `false` 
otherwise. If `fmt` is prefixed with `!`, returns `true` when the `status` 
does not match any of the strings and returns `false` if it does. Statuses in 
the string are separated by commas.

This function is not prefixed with the `std.` namespace.

## Example

The following snippet in `vcl_fetch` marks backend responses with status codes
other than 200, 301, or 302 as not cacheable.

```vcl
if (http_status_matches(beresp.status, "!200,301,302")) {
  set beresp.cacheable = false;
}
```
