Closed
Description
Right now the combination of X-Sendfile does not work with stream wrappers when using the BinaryFileResponse.
Setup: Nginx proxies X-Accel-Redirect files to an object store and the Symfony app accesses the object store using for instance Gaufrette.
Issue: BinaryFileResponse uses getRealPath to create the default path to the file. Stream wrapped files return an empty string here.
Solution: When $this->file->getRealPath();
is empty, let $path
fall back to $this->file->getPathname();
. This way users can map stream wrappers to a Nginx location using the X-Accel-Mapping
header.