Skip to content

Custom headers in 4.x Request #26333

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

Closed
IlCallo opened this issue Feb 27, 2018 · 5 comments
Closed

Custom headers in 4.x Request #26333

IlCallo opened this issue Feb 27, 2018 · 5 comments

Comments

@IlCallo
Copy link

IlCallo commented Feb 27, 2018

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version 4.x

I searched issues and PRs and found nothing about the ability to re-add custom headers mapping in some form, like it where possible in previous versions.

My use case has been described in https://github.com/jdavidbakr/CloudfrontProxies package readme, but also other packages are struggling with the need of managing custom headers (fideloper/TrustedProxy#108).
It's not a critical feature probably, but it was really simple to do before, now it seems that it's no more possible.

Anyone else got this need?

@IlCallo IlCallo changed the title Custom headers with new Request headers management Custom headers in 4.x Request Feb 27, 2018
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Feb 27, 2018

Hello @IlCallo thanks for your report. I think we were not aware that custom headers were actually useful - at least nobody reported any use case when we removed the possibility to use custom headers.
Can you do this early enough now instead, WDYT?
$_SERVER['HEADER_X_FORWARDED_PROTO'] = $_SERVER['HEADER_X_FORWARDED_PROTO_CUSTOM'];

@IlCallo
Copy link
Author

IlCallo commented Feb 27, 2018

Can you do this early enough now instead, WDYT?
I can't really understand this sentence, I guess you where asking if the code you suggested is a valid workaround for the problem.

The first package I linked already solves the problem for this use case scenario using a custom middleware, I created this issue just to let you know that some people is missing that feature and would welcome a way to define custom headers, parallel to the current management or integrated into it.

@Simperfit
Copy link
Contributor

@IlCallo do you want to work on this feature ?

@IlCallo
Copy link
Author

IlCallo commented Apr 18, 2019

I actually moved from backend to frontend development, so I'm a bit rusty and won't have time to catch up...

@Simperfit
Copy link
Contributor

@IlCallo Don't worry !

OskarStark added a commit to symfony/symfony-docs that referenced this issue Aug 16, 2019
…aud)

This PR was merged into the 3.4 branch.

Discussion
----------

add support for custom headers when using a proxy

<!--

If your pull request fixes a BUG, use the oldest maintained branch that contains
the bug (see https://symfony.com/roadmap for the list of maintained branches).

If your pull request documents a NEW FEATURE, use the same Symfony branch where
the feature was introduced (and `master` for features of unreleased versions).

-->

See symfony/symfony#32961 and symfony/symfony#26333.

We should document how to use custom headers when using reverse proxies since `Request::setTrustedHeaderName()` has been deprecated.

Commits
-------

a63c5a6 add support for custom headers when using a proxy
@fabpot fabpot closed this as completed Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants