MEDIUM: htx: Deprecate the option 'http-tunnel' and ignore it in HTX
The option http-tunnel disables any HTTP processing past the first
transaction. In HTX, it works for full h1 transactions. As for the legacy HTTP,
it is a workaround, but it works. But it is impossible to make it works with an
h2 connection. In such case, it has no effect, the stream is closed at the end
of the transaction. So to avoid any inconsistancies between h1 and h2
connections, this option is now always ignored when the HTX is enabled. It is
also a good opportinity to deprecate an old and ugly option. A warning is
emitted during HAProxy startup to encourage users to remove this option.
Note that in legacy HTTP, this option only works with full h1 transactions
too. If an h2 connection is established on a frontend with this option enabled,
it will have no effect at all. But we keep it for the legacy HTTP for
compatibility purpose. It will be removed with the legacy HTTP.
So to be short, if you have to really (REALLY) use it, it will only work for
legacy HTTP frontends with H1 clients.
The documentation has been updated accordingly.
This patch must be backported to 1.9. It is not strictly speaking required but
it will ease futur backports.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 495a25b..ffff9cc 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -3539,6 +3539,16 @@
newsrv->mux_proto = mux_ent;
}
+ /* the option "http-tunnel" is ignored when HTX is enabled and
+ * only works with the legacy HTTP. So emit a warning if the
+ * option is set on a HTX frontend. */
+ if ((curproxy->cap & PR_CAP_FE) && curproxy->options2 & PR_O2_USE_HTX &&
+ (curproxy->options & PR_O_HTTP_MODE) == PR_O_HTTP_TUN) {
+ ha_warning("config : %s '%s' : the option 'http-tunnel' is ignored for HTX proxies.\n",
+ proxy_type_str(curproxy), curproxy->id);
+ curproxy->options &= ~PR_O_HTTP_MODE;
+ }
+
/* initialize idle conns lists */
for (newsrv = curproxy->srv; newsrv; newsrv = newsrv->next) {
int i;