Caddy v2 reverse_proxy rewrite headers with header_up

1. My Caddy version (caddy version):


2. How I run Caddy:

./caddy run -config Caddyfile {
  #log /opt/caddy/logs/log.log
  #errors /opt/caddy/logs/errors.log
  reverse_proxy / {
    header_up SuperstarHeader SuperstarValue
    header_up OriginalDestination {http.request.header.Destination}
    header_up OriginalConnection {http.request.header.Connection}
    header_up +Destination  "*)" "$1"
  tls /opt/caddy/certs/ /opt/caddy/certs/

3. The problem I’m having:

I upgraded my caddy version to v2 for testing http 502 - caddy proxies to svn server · Issue #2018 · caddyserver/caddy · GitHub

The header_up does not work with {http.request.header.*} placeholders.
The headers are present but empty.

Whats the v2 statement for

header_upstream Destination "*)" "$1"

to set the Destination header correctly?

4. Error messages and/or full log output:

The header SuperstarHeader is present with correct value :slight_smile:
The headers OriginalDestination and OriginalConnection are present but empty.
The Destination header is not present

5. What I already tried:

crying in bed alone

6. Links to relevant resources:

http 502 - caddy proxies to svn server · Issue #2018 · caddyserver/caddy · GitHub


Thanks for trying v2!

I just tried with your config, and it works fine. Obviously, the client needs to send those headers in the request or it will be empty. When they are set, your config sets them properly.

(Is that even a valid v1 statement?)

It sounds like you want to append the request path to the Destination header, so:

header_up Destination "{path}"

Should do the trick.

PS. Use v2 beta 11, which was released last week.

It is, yes:

(Seems it shall remain forever undocumented, heh)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.