Skip to content
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

[HttpFoundation] Do not set X-Accel-Redirect for paths outside of X-Accel-Mapping #31604

Closed
wants to merge 1 commit into from

Conversation

vilius-g
Copy link
Contributor

Q A
Branch? 4.2
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

Currently BinaryFileResponse, when configured with X-Accel-Redirect sendfile type, will only substitute file paths specified in X-Accel-Mapping. But if the provided file path does not have a defined prefix, then the resulting header will include absolute path. Nginx expects a valid URI, therefore this will result in an issue that is very hard to detect and debug as it will not show up in error logs and instead the request would just hang for some time and will be re-served without query parameters(?).

…ccel-Mapping

Currently BinaryFileResponse, when configured with X-Accel-Redirect sendfile type,
will only substitute file paths specified in X-Accel-Mapping. But if the provided
file path does not have a defined prefix, then the resulting header will include
the absolute path. Nginx expects a valid URI, therefore this will result in an
issue that is very hard to detect and debug as it will not show up in error logs
and instead the request would just hang for some time and then be re-served
without query parameters(?).
@chalasr chalasr added this to the 4.2 milestone May 25, 2019
@fabpot
Copy link
Member

fabpot commented May 28, 2019

Don't we have the same issue in 3.4?

@vilius-g
Copy link
Contributor Author

Don't we have the same issue in 3.4?

Yes, this affects all versions. But fix requires refactor for 3.4.

@fabpot
Copy link
Member

fabpot commented May 28, 2019

@vilius-g It means that we first need a PR on 3.4. Can you work on one?

@vilius-g
Copy link
Contributor Author

vilius-g commented May 28, 2019

OK, I can make this for 3.4.

@fabpot
Copy link
Member

fabpot commented May 28, 2019

Thank you!

@nicolas-grekas
Copy link
Member

Replaced by #31654

nicolas-grekas added a commit that referenced this pull request May 29, 2019
…side of X-Accel-Mapping (vilius-g)

This PR was merged into the 3.4 branch.

Discussion
----------

[HttpFoundation] Do not set X-Accel-Redirect for paths outside of X-Accel-Mapping

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

#31604 but refactored for 3.4

Commits
-------

a662f61 [HttpFoundation] Do not set X-Accel-Redirect for paths outside of X-Accel-Mapping
@vilius-g vilius-g deleted the fix-x-accel-redirect-mismatch branch May 29, 2019 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants