safe and even recommended to delete such trailers from inbound internet
requests.
+ - reject-content-length-with-te (inbound request and response)
+ Rejects requests and responses having both a Content-Length header
+ field and a Transfer-Encoding header field. While these are permitted
+ by HTTP/1.1 (Transfer-Encoding wins), it can cause problems when the
+ message first passed through an HTTP/1.0 gateway that does not
+ recognize Transfer-Encoding, and can desynchronize this gateway from
+ the rest of the communication. These are still seldom seen in legacy
+ client or server applications, sometimes in relation with compression
+ and/or caching. While HAProxy properly normalizes them, it is generally
+ safe to reject them on public facing listeners.
+
- reject-ctl-in-header-trailer (inbound request and response)
Rejects requests and responses which contain control characters in
their header or trailer field values (codes 0-8,10-31,127). These ones
#define HTTP_HRD_DEL_ALL_TLR 0x00000100
#define HTTP_HRD_REJ_HDR_FOLD 0x00000200
#define HTTP_HRD_REJ_CTL_IN_HDR 0x00000400
+#define HTTP_HRD_REJ_CL_TE 0x00000800
/* insert new masks above this line */
#define HTTP_HRD_ALL 0xFFFFFFFF
state = H1_MSG_DATA;
if (h1m->flags & H1_MF_XFER_ENC) {
if (h1m->flags & H1_MF_CLEN) {
+ if (http_harden(HTTP_HRD_REJ_CL_TE)) {
+ /* strict mode: we don't want to accept that one */
+ goto http_msg_invalid;
+ }
+
/* T-E + C-L: force close and remove C-L */
if (!h1_do_not_close_on_insecure_t_e)
h1m->flags |= H1_MF_CONN_CLO;
{ "delete-all-trailer-fields", HTTP_HRD_DEL_ALL_TLR, HTTP_DIR_BOTH },
{ "reject-header-trailer-folding", HTTP_HRD_REJ_HDR_FOLD, HTTP_DIR_BOTH },
{ "reject-ctl-in-header-trailer", HTTP_HRD_REJ_CTL_IN_HDR, HTTP_DIR_BOTH },
+ { "reject-content-length-with-te", HTTP_HRD_REJ_CL_TE, HTTP_DIR_BOTH },
/* insert new hardening options above this line */
{ "all", HTTP_HRD_ALL, HTTP_DIR_BOTH },
{ NULL, 0 }