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

Document why REMOTE_ADD may not be the user's IP address #1037

Merged
merged 1 commit into from
May 22, 2015

Conversation

Starefossen
Copy link
Contributor

This PR updates the Gunicorn deploy documentation on why REMOTE_ADDR may not always be the IP address of the user.

Close: #1035
Related: #633

Signed-off-by: Hans Kristian Flaatten hans.kristian.flaatten@turistforeningen.no

@Starefossen Starefossen force-pushed the remote-addr-disambiguation branch from 2a8e67b to 8e6b5dc Compare May 21, 2015 09:49
Starefossen pushed a commit to Starefossen/gunicorn that referenced this pull request May 21, 2015
Gunicorn v19 removed functionality which updated `REMOTE_ADDR` to the value of
the `X-Forwared-For` header if received from a trusted upstream client.  This
was a violation of RFC 3875 CGI Version 1.1, and was hence removed.

Close: benoitc#1035
PR-URL: benoitc#1037
Related: benoitc#633

Signed-off-by: Hans Kristian Flaatten <hans.kristian.flaatten@turistforeningen.no>
@Starefossen Starefossen changed the title Document why REMOTE_ADD may not be the user's IP Document why REMOTE_ADD may not be the user's IP address May 21, 2015
@berkerpeksag
Copy link
Collaborator

LGTM

@Starefossen
Copy link
Contributor Author

Maybe also add that REMOTE_ADDR will be empty if you bind Gunicorn to a unix socket as well?

@benoitc
Copy link
Owner

benoitc commented May 21, 2015

@Starefossen good idea :)

@Starefossen Starefossen force-pushed the remote-addr-disambiguation branch from 8e6b5dc to e0aad07 Compare May 21, 2015 20:08
Starefossen pushed a commit to Starefossen/gunicorn that referenced this pull request May 21, 2015
Gunicorn v19 removed functionality which updated `REMOTE_ADDR` to the value of
the `X-Forwared-For` header if received from a trusted upstream client.  This
was a violation of RFC 3875 CGI Version 1.1, and was hence removed.

Close: benoitc#1035
PR-URL: benoitc#1037
Related: benoitc#633

Signed-off-by: Hans Kristian Flaatten <hans.kristian.flaatten@turistforeningen.no>
@Starefossen
Copy link
Contributor Author

Ok, I have now amended a paragraph to my original commit.

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
...

It is also worth noticing that the ``REMOTE_ADDR`` will be completely empty if
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"worth noting" would be the typical phrase, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and fixed!

@Starefossen Starefossen force-pushed the remote-addr-disambiguation branch from e0aad07 to 7b6f8a2 Compare May 21, 2015 20:23
Starefossen pushed a commit to Starefossen/gunicorn that referenced this pull request May 21, 2015
Gunicorn v19 removed functionality which updated `REMOTE_ADDR` to the value of
the `X-Forwared-For` header if received from a trusted upstream client.  This
was a violation of RFC 3875 CGI Version 1.1, and was hence removed.

Close: benoitc#1035
PR-URL: benoitc#1037
Related: benoitc#633

Signed-off-by: Hans Kristian Flaatten <hans.kristian.flaatten@turistforeningen.no>
...

It is also worth noting that the ``REMOTE_ADDR`` will be completely empty if you
bind Gunicorn to a unix socket and not a tcp host:port touple.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one last typo :) s/touple/tuple

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what you get for not running spell check before pushing 😝 Fixed now.

@tilgovi
Copy link
Collaborator

tilgovi commented May 21, 2015

I love documentation PRs!!! :) :)

@berkerpeksag
Copy link
Collaborator

@tilgovi +1 :)

@benoitc
Copy link
Owner

benoitc commented May 21, 2015

@tilgovi :)

Gunicorn v19 removed functionality which updated `REMOTE_ADDR` to the value of
the `X-Forwared-For` header if received from a trusted upstream client.  This
was a violation of RFC 3875 CGI Version 1.1, and was hence removed.

Close: benoitc#1035
PR-URL: benoitc#1037
Related: benoitc#633

Signed-off-by: Hans Kristian Flaatten <hans.kristian.flaatten@turistforeningen.no>
@Starefossen Starefossen force-pushed the remote-addr-disambiguation branch from 7b6f8a2 to 85d857d Compare May 21, 2015 21:05
@Starefossen
Copy link
Contributor Author

I'm just happy to be of any help. Thank you for making Gunicorn ❤️

berkerpeksag added a commit that referenced this pull request May 22, 2015
Document why REMOTE_ADD may not be the user's IP address
@berkerpeksag berkerpeksag merged commit e6cf15c into benoitc:master May 22, 2015
@berkerpeksag
Copy link
Collaborator

Thanks!

berkerpeksag pushed a commit that referenced this pull request Nov 16, 2018
The doc change introduced in #1037 is initially helpful but then internally
inconsistent. It correctly points out that X-Forwarded-For is no longer
used in setting REMOTE_ADDR (c487368),
but then confusingly indicates a solution using the X-Forwarded-For header.

The deployment doc provides a full configuration example which includes
proxy headers as set by nginx. What is missing, before this patch, is a
clear suggestion on how to make use of the header in Gunicorn's access
log.

Accordingly, remove the confusing suggestion and replace it with a drop-in
replacement for Gunicorn's default access log format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document that REMOTE_ADDR is not necessarily the user IP
4 participants