Intercept HTTP CONNECT Method / Tunnel only


I’m fairly new to HAProxy and trying to establish if it is possible to replicate something that we can do within Fiddler Fiddler Classic but move to HAProxy…

Essentially, all I want to do is let all traffic pass through to another internal/internet proxy and intercept only a specific HTTP CONNECT method.

E.G. If host = then rewrite to host =
As a result, all traffic will tunnel to the new host…

For example in Fiddler I can script like this :

// Capture only and rewrite host to for the CONNECT method and tunnel
if (oSession.HTTPMethodIs("CONNECT") && ( == "")) { = "";

Client → HAProxy [Intercept CONNECT / Rewrite ] → Internal Proxy → Internet

Is this even possible with HAProxy…???
I cannot seem to find exact similar use-cases…



You can try to set up un acl, to send requests to defined backend and then rewrite Host Header :

acl mydomain hdr(host) -i
use_backend if mydomain

    http-request set-header Host
    server check

This config replace host header when forwarding the request to the backend. We use it with clear http and it just works. not sur with ssl backend.