> This page is for Applications Protection.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.humansecurity.com/llms.txt.

# Filter by HTTP Method

### Filter by HTTP Method

You can filter out requests based on an HTTP method. For example, to perform a health check, you may want to filter out requests that use theHEAD HTTP method.

**TO define an HTTP method by which to filter out requests:**

1. Open the**PX_CUSTOM.vcl** file.
2. Add the required HTTP method as a regex expression using req.request.

**EXAMPLE**

```java
sub px_custom_filter_by_http_method {
if ((req.request ~ "(?i)(HEAD)$") {
   set req.http.X-PX-filter-by:method = "1";
  }
}
```

To learn more about custom subroutines, see [Customized subroutines](/applications/fastly-customized-subroutines).

**TO enable the feature:**

1. Open the **PX_CONFIG.vcl** file.
2. Set the **px_filter_by_http_method_enabled** value to "true" (enabled). The default is "false" (disabled).

```javascript
table px_configs {
  "px_filter_by_http_method_enabled": "true",
}
```

> **Test**
>
> 1. Send a request that includes one of the defined HTTP methods.
> 2. Open the console and search for your request. If you can't find the request, the feature is configured correctly.