caddy icon indicating copy to clipboard operation
caddy copied to clipboard

Including matcher in 'handle_response' line has confusing error

Open foxt opened this issue 1 year ago • 1 comments

If you use the following Caddyfile:

reverse_proxy localhost:8000 {
    handle_response header Foo {
        # do something
    }
}

you will get the following error: adapting config using caddyfile: parsing caddyfile tokens for 'reverse_proxy': configuring 'handle_response' for status code replacement is no longer supported. Use 'replace_status' instead. even though you're not touching the status code.

If you use either

handle_response header Foo * {

or

@bad status 500
handle_response @bad {

no error is raised.

Seems to be a check implemented at https://github.com/caddyserver/caddy/blob/54a0c8f94821f393edec1a1bc9459f2363c95117/modules/caddyhttp/reverseproxy/caddyfile.go#L915 that just complains if there are two parameters passed to handle_response.

foxt avatar Aug 20 '24 15:08 foxt

Ah thanks.

@francislavoie This was from about 2 years ago; maybe it's time to revisit while we're at it? The previous line says // TODO: Remove this check at some point in the future.

mholt avatar Aug 20 '24 18:08 mholt