It’s because respond
comes before reverse_proxy
in the default directive order:
You can do one of these things:
- Wrap your directives in a
route { }
block:
route {
reverse_proxy @apirequests localhost:5000
respond "No soup for you!"
}
- Wrap each directive in a
handle { }
block:
handle @apirequests {
reverse_proxy localhost:5000
}
handle {
respond "No soup for you!"
}
(Actually you could just wrap the reverse_proxy
in handle
, since handle
comes before respond
already.)
- Or use this global option:
{
order reverse_proxy before respond
}
so that the reverse_proxy is evaluated first.
(In hindsight, I probably could have put respond
more toward the end of the default ordering, but it is useful sometimes as in some cases you want the reverse_proxy
to be the “else”, and anyway, it’s too late to change it now.)
See also: