Skip to content

Caddy not setting PROXYv2 TLV fields in reverse_proxy mode #5967

Open
@eest

Description

@eest

Hello,

I am attempting to use Caddy for TLS termination in front of a Varnish cache server.
The configuration for hooking up Caddy to Varnish looks like this:

reverse_proxy 127.0.0.1:8443 {
        transport http {
                proxy_protocol v2
        }
}

The traffic flow works well, but then I wanted to be able to set headers in Varnish based on TLV attributes in the PROXYv2 packets, looking something like this:

sub vcl_recv {
    if (proxy.is_ssl()) {
      set req.http.X-Forwarded-Proto = "https";
    } else {
      set req.http.X-Forwarded-Proto = "http";
    }
}

This is using the Varnish vmod_proxy to read TLV values: https://varnish-cache.org/docs/trunk/reference/vmod_proxy.html.

I then noticed that Caddy does not appear to set such values, and based on mastercactapus/proxyprotocol#3 it looks like the currently used proxy protocol library does not support setting them either. I have also seen that there appears to be WIP to start using another proxy protocol lib in #5915.

From what I can tell even if the latter PR is merged this would still not set TLV fields, would it make sense to add such code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions