Menu

HAProxy request rules execute in declaration order
📰

HAProxy request rules execute in declaration order

DEV Community: security·kozhevniko·16 days ago
#yz4QM5Tw
#devtosecurity#devto#dev#request#haproxy
Long article (441 words) — no AI summary yet.
Reading 0:00
15s threshold

HAProxy request rules execute in declaration order

An edge proxy often performs several jobs before it selects a backend: reject forbidden paths, normalize headers, apply rate limits, and choose a certificate or upstream. HAProxy's http-request rules are evaluated in declaration order. Rules inherited from defaults run before rules in the associated proxy. A security decision placed after a header mutation can therefore see different input than the administrator expected.

Order security before routing

A minimal policy should make the intended deny path visible and keep later rules from changing the decision.

frontend public_https bind :443 ssl crt /etc/haproxy/certs/ http-request deny if { path_beg /internal } http-request set-header X-Forwarded-Proto https default_backend application

Enter fullscreen mode

Exit fullscreen mode

The example is only a starting point.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.