-
-
Notifications
You must be signed in to change notification settings - Fork 278
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
docs: X-Sendfile/X-Accel-Redirect #896
base: main
Are you sure you want to change the base?
Conversation
how to deal with that if we're storing files in AWS S3-like storages? |
It looks like this is missing sending the X-Accel-Mapping header that Symfony needs to generate the correct redirect. |
@nicolas-grekas If I am understanding correctly, this is a header sent from the webserver to PHP? |
@withinboredom correct, to advertise the mapping between URL prefix and internal path. |
I think this is doable, just needs to be documented. I'll take a look later today. |
@nicolas-grekas it's not necessary because we change the root directory (see also dunglas/frankenphp-demo#28) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for me with the latest Docker container.
I just noticed a few "problems" when using Symfony.
# ... | ||
|
||
+ # Needed for Symfony, Laravel and other projects using the Symfony HttpFoundation component | ||
+ request_header X-Sendfile-Type x-accel-redirect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without setting X-Accel-Mapping
using BinaryFileResponse
Symfony would throw an Exception.
The header is not required when setting the X-Accel-Redirect
header on a response manually.
Maybe this should be documented too, like, e.g.:
+ request_header X-Sendfile-Type x-accel-redirect | |
+ request_header X-Sendfile-Type x-accel-redirect | |
+ # Set the following header if you're using BinaryFileResponse (see below for an example) | |
+ #request_header X-Accel-Mapping /actual/path/to/private-files=/private-files |
+ | ||
+ # Remove the X-Accel-Redirect header set by PHP for increased security | ||
+ header -X-Accel-Redirect | ||
+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be more headers documented in the example?
There are the headers BinaryFileResponse
will set.
+ | |
+ copy_response_headers | |
+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, never mind. I was thinking of handle_response
in Caddy when using fastcgi, where copy_response_headers
is needed to get all headers from upstream. In intercept
apparently all headers are present anyway (as there's no upstream).
What problems did you have? |
Only my comments on the review. Any one of them turned out to be wrong assumptions on my end anyway. |
Closes #884.
Needs caddyserver/caddy#6429.