# Disabling HTTP Processing For Unrecognized HTTP Methods

**URL:** <https://community.f5.com/t/disabling-http-processing-for-unrecognized-http-methods/64527>\
**Category:** Community CodeShare\
**Tags:** irules, devops, application-delivery, http\
**Created:** [January 30, 2015, 12:38pm UTC](https://community.f5.com/t/disabling-http-processing-for-unrecognized-http-methods/64527 "2015-01-30T12:38:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deb\_Allen\_18](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@Deb\_Allen\_18](https://community.f5.com/u/Deb_Allen_18)\
**Post date:** [January 30, 2015, 12:38pm UTC](https://community.f5.com/t/disabling-http-processing-for-unrecognized-http-methods/64527/1 "2015-01-30T12:38:14Z")

</div>

**Problem this snippet solves:**

The iRule below disables HTTP processing for requests using HTTP methods that are not recognized by the BIG-IP HTTP profile. For example, Web-based Distributed Authoring and Versioning (WebDAV) uses the following extended HTTP methods: PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK. Requests using one of these methods may provoke the behavior described in AskF5 SOL7581: [404 Page not found | BIG-IP Documentation](https://support.f5.com/kb/en-us/solutions/public/7000/500/sol7581.html?sr=2105288) Unrecognized HTTP methods without a specified content-length or chunking header can cause the connection to stall . Use of these or other methods not described in RFC2616 (HTTP/1.1) may require an iRule similar to the following associated with the virtual server which disables further HTTP processing when they are seen.

**How to use this snippet:**

Note: You may have to disable the “HTTP::enable” command with a comment if using the iRule on an APM protected virtual service.

**Code :**

```auto
when CLIENT_ACCEPTED {
   # Enable HTTP processing for all requests by default
   HTTP::enable
}
when HTTP_REQUEST {
   # selectively disable HTTP processing for specific request methods
   switch [HTTP::method] {
      "MOVE" -
      "COPY" -
      "LOCK" -
      "UNLOCK" -
      "PROPFIND" -
      "PROPPATCH" -
      "MKCOL" { HTTP::disable }
   }
}

```

---

<div class="post-metadata">

**Author:** ![JRahm](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/jrahm/32/3327_2.png) [@JRahm](https://community.f5.com/u/JRahm)\
**Post date:** [January 30, 2015, 12:38pm UTC](https://community.f5.com/t/disabling-http-processing-for-unrecognized-http-methods/64527/2 "2015-01-30T12:38:29Z")

</div>

Contributed by deb.

---

<div class="post-metadata">

**Author:** ![Vladimir\_Akhmarov](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/vladimir_akhmarov/32/10302_2.png) [@Vladimir\_Akhmarov](https://community.f5.com/u/Vladimir_Akhmarov)\
**Post date:** [December 16, 2016, 3:21pm UTC](https://community.f5.com/t/disabling-http-processing-for-unrecognized-http-methods/64527/3 "2016-12-16T15:21:43Z")

</div>

Using this iRule has one limitation for IIS servers acting as a WebDAV distribution point with SSL Offloading on BIG-IP enabled. When SSL Offloading on BIG-IP is enabled and client uses COPY/MOVE method there is a header with name “Destination” that starts with **https** (because client is connecting to WebDAV with SSL). IIS does not recognises that destination because servers are running as HTTP and expecting **http** appended string in “Destination” header

Here are my fixed iRule:

```tcl
Works for TMOS 11.6.0+
 https://support.f5.com/csp//article/K13285

 Make this iRule to be called the last one because of the HTTP::disable
priority 700

when CLIENT_ACCEPTED
{
     Enable HTTP processing for all requests by default
    HTTP::enable
}

when HTTP_REQUEST
{
     Selectively disable HTTP processing for specific request methods
    switch [HTTP::method]
    {
        "COPY" -
        "MOVE"
        {
             Replace Destination header with http if using SSL Offloading
            if { [HTTP::header Destination] starts_with "https" }
            {
                HTTP::header replace Destination [string map -nocase {https http} [HTTP::header value Destination]]
            }

            HTTP::disable
        }
        "MKCOL" -
        "PROPPATCH"
        {
            HTTP::disable
        }
   }
}

```

---

<div class="post-metadata">

**Author:** ![Jason\_Adams](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/jason_adams/32/3658_2.png) [@Jason\_Adams](https://community.f5.com/u/Jason_Adams)\
**Post date:** [March 9, 2017, 6:25pm UTC](https://community.f5.com/t/disabling-http-processing-for-unrecognized-http-methods/64527/4 "2017-03-09T18:25:59Z")

</div>

OPTIONS should be added to the switch statement:

The Linked DevCentral Article needs to be updated to include ‘OPTIONS’ HTTP Request Method.

```tcl
when HTTP_REQUEST {
    selectively disable HTTP processing for specific request methods
   switch [HTTP::method] {
      "MOVE" -
      "COPY" -
      "LOCK" -
      "UNLOCK" -
      "OPTIONS" -
      "PROPFIND" -
      "PROPPATCH" -
      "MKCOL" { HTTP::disable }
   }
}

```

---

<div class="post-metadata">

**Author:** ![Roy\_Jee](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/roy_jee/32/33821_2.png) [@Roy\_Jee](https://community.f5.com/u/Roy_Jee)\
**Post date:** [September 4, 2019, 11:23am UTC](https://community.f5.com/t/disabling-http-processing-for-unrecognized-http-methods/64527/5 "2019-09-04T11:23:07Z")

</div>

How can we disable HTTP HEAD method as per PCI compliance
