Enable x-accel-redirect
closes #365
This adds x-accel-redirect and friends by passing a "filter" to Frankenphp from Caddy. This "filter" allows us to halt output if we have a rewriting matcher that should take over the request. For backward compatibility, context strings are kept as http.reverse_proxy.*.
This is a refactoring of the reverse proxy functionality built into Caddy but adapted for FrankenPHP.
php_server {
@accel header X-Accel-Redirect *
handle_response @accel {
root * /
rewrite {http.reverse_proxy.header.X-Accel-Redirect}
file_server
}
}
Todo:
- [x] worker support
- [x] tests
- [x] clean up debug log lines
- [x] return docker files to a pristine condition
- [x] refactoring
- [x] documentation (for caddyfile)
- [x] documentation (for frankenphp -- hooks)
Thoughts:
- Anything other than
handle_responseis probably out of scope for this PR.
Hey @withinboredom, do you mind if I push in your branch to finish this feature?
Yeah, go for it. I just haven't had much time to get to this.
Here is my alternative PR (directly in Caddy): https://github.com/caddyserver/caddy/pull/6232
Closing in favor of https://github.com/caddyserver/caddy/pull/6232 that is likely to be merged. Thanks for paving the way @withinboredom!!
🥳