MINOR: http: Add 410 to http-request deny
This patch adds http status code 410 Gone to http-request deny. See
issue #80.
(cherry picked from commit 272e29b5cc55baacce96350a5921a5ae204f43d3)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit d97b1b62743da4b6a85e59d176c9e7791f83c69a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/doc/configuration.txt b/doc/configuration.txt
index 37bdb99..530236d 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -366,6 +366,8 @@
accessing the stats page)
403 when a request is forbidden by a "block" ACL or "reqdeny" filter
408 when the request timeout strikes before the request is complete
+ 410 when the requested resource is no longer available and will not
+ be available again
500 when haproxy encounters an unrecoverable internal error, such as a
memory allocation failure, which should never happen
502 when the server returns an empty, invalid or incomplete response, or
@@ -3666,7 +3668,7 @@
yes | yes | yes | yes
Arguments :
<code> is the HTTP status code. Currently, HAProxy is capable of
- generating codes 200, 400, 403, 405, 408, 425, 429, 500, 502,
+ generating codes 200, 400, 403, 405, 408, 410, 425, 429, 500, 502,
503, and 504.
<file> designates a file containing the full HTTP response. It is
@@ -3715,7 +3717,7 @@
yes | yes | yes | yes
Arguments :
<code> is the HTTP status code. Currently, HAProxy is capable of
- generating codes 200, 400, 403, 405, 408, 425, 429, 500, 502,
+ generating codes 200, 400, 403, 405, 408, 410, 425, 429, 500, 502,
503, and 504.
<url> it is the exact contents of the "Location" header. It may contain
@@ -3747,7 +3749,7 @@
yes | yes | yes | yes
Arguments :
<code> is the HTTP status code. Currently, HAProxy is capable of
- generating codes 200, 400, 403, 405, 408, 425, 429, 500, 502,
+ generating codes 200, 400, 403, 405, 408, 410, 425, 429, 500, 502,
503, and 504.
<url> it is the exact contents of the "Location" header. It may contain
diff --git a/include/common/http.h b/include/common/http.h
index b0befa5..eb12f25 100644
--- a/include/common/http.h
+++ b/include/common/http.h
@@ -85,6 +85,7 @@
HTTP_ERR_403,
HTTP_ERR_405,
HTTP_ERR_408,
+ HTTP_ERR_410,
HTTP_ERR_421,
HTTP_ERR_425,
HTTP_ERR_429,
diff --git a/src/http.c b/src/http.c
index 66a4282..0e9977d 100644
--- a/src/http.c
+++ b/src/http.c
@@ -223,6 +223,7 @@
[HTTP_ERR_403] = 403,
[HTTP_ERR_405] = 405,
[HTTP_ERR_408] = 408,
+ [HTTP_ERR_410] = 410,
[HTTP_ERR_421] = 421,
[HTTP_ERR_425] = 425,
[HTTP_ERR_429] = 429,
@@ -278,6 +279,15 @@
"\r\n"
"<html><body><h1>408 Request Time-out</h1>\nYour browser didn't send a complete request in time.\n</body></html>\n",
+ [HTTP_ERR_410] =
+ "HTTP/1.1 410 Gone\r\n"
+ "Content-length: 114\r\n"
+ "Cache-Control: no-cache\r\n"
+ "Connection: close\r\n"
+ "Content-Type: text/html\r\n"
+ "\r\n"
+ "<html><body><h1>410 Gone</h1>\nThe resource is no longer available and will not be available again.\n</body></html>\n",
+
[HTTP_ERR_421] =
"HTTP/1.1 421 Misdirected Request\r\n"
"Content-length: 104\r\n"
@@ -384,6 +394,7 @@
case 403: return HTTP_ERR_403;
case 405: return HTTP_ERR_405;
case 408: return HTTP_ERR_408;
+ case 410: return HTTP_ERR_410;
case 421: return HTTP_ERR_421;
case 425: return HTTP_ERR_425;
case 429: return HTTP_ERR_429;