Using placeholders in replace_response

1. Caddy version (caddy version):

v2.4.5 h1:P1mRs6V2cMcagSPn+NWpD+OEYUYLIf6ecOa48cFGeUg=

2. How I run Caddy:

in a docker image

a. System environment:

ubuntu based docker image

b. Command:

caddy --config /etc/caddy/Caddyfile

c. Service/unit/compose file:

S6 running the command above

d. My complete Caddyfile or JSON config:

        order replace after encode

:80 {

        redir /subpath /subpath/
        route /subpath/* {
                uri strip_prefix /subpath
                replace {
                        http://example/(subpath/)?    {}/subpath/

                reverse_proxy {
                        header_down Location (https?://)([^/]+)/(subpath/)? $2$3/subpath/
                        header_down Location ^/(subpath/)? /subpath/
                        header_up Access-Control-Allow-Origin '*'

3. The problem I’m having:

attempting to use {} as part of the replacement in replace_response doesn’t use the placeholder. Instead it uses the literal string {}

4. Error messages and/or full log output:

console error shows http

5. What I already tried:

just as above

6. Links to relevant resources:


You should open an issue on the replace-response plugin repo for this, since it’s a feature request.

will do! I wasn’t sure if it was supposed to be supported already - thank you!

This topic was automatically closed after 30 days. New replies are no longer allowed.