GrepBoard/Manuals
605 manuals ·

HAProxy 'option httplog' not usable, falling back to tcplog: fix

·Tested on HAProxy 3.4.7 (Docker haproxy:lts) · Ubuntu 24.04 haproxy 2.8.30 · 2026-10·Test scope ↓·5 steps

HAProxy 'option httplog' not usable with frontend (needs 'mode http'): defaults httplog reached a mode tcp frontend. Add option tcplog there or split defaults.

output
[WARNING]  (1) : parsing [/usr/local/etc/haproxy/a.cfg:7] : 'option httplog' not usable with frontend 'tls_passthrough' (needs 'mode http'). Falling back to 'option tcplog'.

option httplog only works in HTTP mode, and it ended up on a frontend in mode tcp (here tls_passthrough). As the message says, HAProxy switches that frontend to option tcplog and does not block startup (exit code 0). Almost always the option httplog in defaults was inherited by a TCP frontend, and one option tcplog line in that frontend clears it.

[1] Look at the line number in the warning. It points to **the option httplog line, not the frontend**. Line 7 above is inside defaults:

run/cfg/a.cfg
defaults    mode http    log global    option httplog…frontend tls_passthrough    mode tcp    bind :8443    default_backend app_tls

Use the frontend name in the warning ('tls_passthrough') to find the mode tcp section. The default /etc/haproxy/haproxy.cfg in Ubuntu 24.04's package also sets mode http and option httplog in defaults, so adding a TCP frontend for TLS passthrough produces exactly this warning.

output
20:defaults21:	log	global22:	mode	http23:	option	httplog

[2] If no frontend sets mode and you still get the warning, defaults lacks mode http. The default mode is TCP, so with only option httplog in defaults, the frontend you meant for HTTP (web) runs as TCP as well:

output
[WARNING]  (1) : parsing [/usr/local/etc/haproxy/b.cfg:6] : 'option httplog' not usable with frontend 'web' (needs 'mode http'). Falling back to 'option tcplog'.

Here the real problem is the wrong mode, not the log format. If you meant to handle HTTP, add mode http to defaults. With it, the warning was gone.

[3] Add option tcplog to the TCP frontend. A value set in the frontend overrides what it inherited from defaults.

run/cfg/a-tcplog.cfg
frontend tls_passthrough    option tcplog    mode tcp    bind :8443    default_backend app_tls

Trying no option httplog instead turns it into an error, on both 3.4.7 and 2.8.30:

output
[ALERT]    (1) : config : parsing [/usr/local/etc/haproxy/a-no.cfg:17]: negation/default is not supported for option 'httplog'.

[4] With several HTTP and TCP frontends, split defaults into two named sections. The official docs say each section takes its settings from the latest defaults before it, and that from <name> picks a specific one.

run/cfg/a-named.cfg
defaults http_defaults    mode http    log global    option httplog…defaults tcp_defaults    mode tcp    log global    option tcplog…frontend web from http_defaults    bind :8080    default_backend app backend app from http_defaults    server s1 192.0.2.10:80 frontend tls_passthrough from tcp_defaults    bind :8443    default_backend app_tls backend app_tls from tcp_defaults    server s1 192.0.2.10:443

With from on both HTTP sections and both TCP sections, this config passed without warnings on 3.4.7 and on Ubuntu's 2.8.30.

**Add from http_defaults to every existing HTTP section as well.** If you insert defaults tcp_defaults in the middle of an existing config, every section below it without from inherits tcp_defaults and becomes mode tcp (the docs' "latest defaults before it" rule). Here is the same config with from removed from frontend web and backend app, and option forwardfor added to web (same on 3.4.7 and 2.8.30):

output
[WARNING]  (10) : config : parsing [/usr/local/etc/haproxy/a-named-trap-fwd.cfg:28] : defaults section 'tcp_defaults' (declared at /usr/local/etc/haproxy/a-named-trap-fwd.cfg:12) is explicitly referenced by another proxy and implicitly used here. To avoid any ambiguity don't mix both usage. Add a last defaults section not explicitly used or always use explicit references.[WARNING]  (10) : 'option forwardfor' ignored for frontend 'web' as it requires HTTP mode.Warnings were found.

The ignored option forwardfor shows that web silently became TCP, yet the exit code is still 0, so a deploy goes through. A section with no HTTP-only lines only gets the first warning (is explicitly referenced by another proxy and implicitly used here); if you see that text, some section is missing its from. The line number in the warning (28) was the first line of the section after the one missing from. To undo, delete the added defaults tcp_defaults block and the from keywords and go back to step [3].

[5] Check the config. Success output differs by version, so judge by the exit code.

console
$ haproxy -c -f /etc/haproxy/haproxy.cfg; echo "exit=$?"
VersionWith the warningAfter the fix
3.4.7 (official image)Warnings were found., exit 0no output, exit 0
2.8.30 (Ubuntu 24.04)Warnings were found. + Configuration file is valid, exit 0Configuration file is valid, exit 0

A warning alone exits 0, so automated deploys let it through. Adding -dW turns this warning into Some warnings were found and 'zero-warning' is set. Aborting. with exit code 1. How to use it and back it out is in HAProxy -c "Warnings were found". Once it passes, apply with sudo systemctl reload haproxy.

To read a TCP log line, see Read one HAProxy log line.

Analyze your HAProxy log in the browser ↗ — nothing is uploaded.

#haproxy#httplog#tcplog#mode-tcp