be used with confirmed valid endpoints, and the risk is low because
HTTP/1.0-only agents became rare.
+ - "trace-with-content" (request): this controls the acceptance of TRACE
+ HTTP requests containing a message body. This is forbidden by latest
+ updates of the specification because it can be used to build smuggling
+ attacks with certain servers. TRACE is exclusively used for attacks and
+ occasionally for debugging anyway. The risk is high, particularly for
+ requests originating from untrusted clients. Do not enable this without
+ verifying that servers support it and that the application absolutely
+ requires it.
+
By default, for backward compatibility, all violations above are flagged as
acceptable, meaning that a proxy having "option accept-unsafe-http-*" will
accept them all. It may be a good practice to explicitly reset them to "none"
HTTP_VIO_VERSION_STRING, // unsupported version string
HTTP_VIO_WEBSOCKET_KEY, // invalid or missing websocket-key header
HTTP_VIO_1XX_HTTP_1_0, // 1xx in response from or to HTTP/1.0
+ HTTP_VIO_TRACE_CONTENT, // TRACE with C-L>0 or T-E
/* insert new violations above this line */
HTTP_VIO_TOTAL_COUNT = 32, // end marker
HTTP_VIO_NONE, // special code for none
{ "invalid-version-string", HTTP_VIO_VERSION_STRING, HTTP_DIR_BOTH },
{ "invalid-websocket-key", HTTP_VIO_WEBSOCKET_KEY, HTTP_DIR_BOTH },
{ "http-1.0-status-1xx", HTTP_VIO_1XX_HTTP_1_0, HTTP_DIR_RES },
+ { "trace-with-content", HTTP_VIO_TRACE_CONTENT, HTTP_DIR_REQ },
/* insert new violations above this line */
{ "all", HTTP_VIO_ALL, HTTP_DIR_BOTH },
{ NULL, 0 }
if (sl->flags & HTX_SL_F_CONN_UPG)
msg->flags |= HTTP_MSGF_CONN_UPG;
+ /* check for incompatibilities with content */
+ if (!(msg->flags & HTTP_MSGF_BODYLESS)) {
+ /* there IS a body, either via T-E, or C-L > 0. For TRACE, this
+ * is a violation of RFC9110 #9.3.8.
+ */
+ if (txn->meth == HTTP_METH_TRACE &&
+ !(s->be->options2 & PR_O2_REQBUG_OK &&
+ global.acc_hreq_vio & (1U << HTTP_VIO_TRACE_CONTENT))) {
+ stream_inc_http_err_ctr(s);
+ goto return_bad_req;
+ }
+ }
+
/* we can make use of server redirect on GET and HEAD */
if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
s->flags |= SF_REDIRECTABLE;