Skip to contents

Cloudflare's firewall can refuse a client that does not look like a browser outright, with a 403 and its own block page, while a real browser is served.

Usage

is_block(status, headers, body = NULL)

Arguments

status

The HTTP status code.

headers

The response headers, as the raw header block (one string, lines separated by \r\n) or as a named list such as curl::parse_headers_list() makes of it.

body

The response body, as a string.

Value

TRUE for that page: a 403 from server: cloudflare whose body says "Sorry, you have been blocked".

Examples

is_block(403, "HTTP/2 403\r\nserver: cloudflare\r\n\r\n",
         "<html><title>Attention Required! | Cloudflare</title>...")
#> [1] TRUE
is_block(403, "HTTP/2 403\r\nserver: nginx\r\n\r\n", "Forbidden")
#> [1] FALSE