Open Kludex opened 9 months ago
@nhairs Do you have any proposal on how we should implement this?
Can we have the X-Forwarded-*
and Forwarded
at the same time?
Can we have the
X-Forwarded-*
andForwarded
at the same time?
Per the code comments I left in my open PR, I initially thought this was the case. i.e. use the official headers if available otherwise fallback to the x-forwarded headers. But I suspect that such behaviour might introduce vulnerabilities into user's applications. It might be better to take a PEP20 "Explicit is better than implicit" approach which leads me to...
@nhairs Do you have any proposal on how we should implement this?
My gut feeling is that we're better off making users explicitly choose which headers they want to extract info from. Trying to support all of them from the commandline seems like a lot of work though. What about supporting X-Real-IP
headers?
Which leads to my suggestion on #2231:
Makes sense to be explicit on what is supported.
Maybe we can check how others are doing it? Are we going to pioneer this "choices"?
Discussed in https://github.com/encode/uvicorn/discussions/2236