Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BinaryFileResponse X-Sendfile support for stream wrappers #12990

Closed
@Sander-Toonen

Description

@Sander-Toonen

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions