-
-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intercept responses for nginx-like X-Accel-Redirect handling #365
Comments
That is a really good suggestion. I've never used this feature but I'm aware of it. I guess the question is, should this be enabled by default or require extra configuration like the fastcgi plugin? I'd be more than happy to pick this one up @dunglas. |
I myself am not a fan of implicitly copying Nginx specifiy syntax (and I don't think any of the other X-Accel stuff matters for or even applies to Caddy/FrankenPHP). X-Accel-Redirect being the exception, maybe something configurable might do the trick? A repeatable option with a simple combination of Like:
Of course, |
I wonder if we even need headers. Maybe something a function like this can be called from application code:
The downside to something like this is that it won't be compatible with most libraries that take advantage of X-Accel-Redirect. |
Yes, exactly my opinion too. I experimented with FrankenPHP yesterday and found out that we can easily use it as a drop-in replacement (we're already using Caddy too), so I'd always vote for compatibility with existing setups. I understand that using headers to tell the downstream what to do with a response is somewhat strange design but very flexible as well (see caches). Keeping X-Accel-Redirect in applications allows the Caddy setup to either use it or even pass it to the next downstream that might be a reverse-proxy doing load-balancing and streaming files from an S3 storage. |
Symfony HttpFoundation (so also Laravel, Drupal etc) have native support for So I'll go the header way too, this will allow all these existing apps to leverage this feature. |
Caddy allows the responses in reverse_proxy to be intercepted via handle_response like so:
This allows us to send a "private" file from backend that is available locally without having to stream it through PHP.
I haven't found it in the docs (but maybe didn't look carefully enough), can this be done in FrankenPHP?
The text was updated successfully, but these errors were encountered: