-
Notifications
You must be signed in to change notification settings - Fork 619
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
proxy header handling #67
Conversation
…oto and removed double setting of X-Forwarded-For
Hi @smancke, Thanks for working on this. A couple of comments on the style: In general, it might be better if you separate refactorings (like the change in the test structure) from additions. Also, I think that splitting the Also:
Can you please explain which behavior regarding |
Hi @magiconair, ok - thanks for your comments. The current behaviour for the X-Forwarded-For has in my opinion two errors, leading to strange behaviour:
I have collected the cases, how it is and how it should behave. In my opinion, it's nothing worth to preserve the current behavior by a configuration flag, since it currently is to buggy and strange. case A:
case B:
case C:
case D:
case E:
|
Hmm, I've implemented this in #10 after reading this: https://en.wikipedia.org/wiki/X-Forwarded-For. According to that article the format is |
Here is an example. Lets think about the following case of proxy servers: browser -> nginx -> apache -> fabio -> tomcat-app Then fabio would see: And fabio has to add the apache-ip to the X-Forwarded-For list. So that tomcat would see: So, the LocalIP of fabio is send to the tomcat as RemoteAddr, not forwarded for. |
Right, the proxy list is the list of the previous proxies. OK, makes sense. Thx for clarifying. |
I had to add the X-Forwarded-Proto header to get fabio working as reverse proxy for the docker-registry with tls. While doing this, I made a more broaden overwork on the proxy headers.
So, here is a proposal for additional handling of proxy headers:
Please let me know, what you think about this. If you have any remarks on this, feel free to formulate your wishes and I will overwork the pull request.
(I'm also thinking about an integration test for the headers, which show the combined result of the addHeaders() and the Golang Reverse Proxy - but I was not sure, if you would like tests which test more than one unit.)