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

Access real-remote-addr through env #144

Open
asutoshpalai opened this issue Apr 1, 2017 · 2 comments
Open

Access real-remote-addr through env #144

asutoshpalai opened this issue Apr 1, 2017 · 2 comments

Comments

@asutoshpalai
Copy link

When deployed behind a proxy (e.g. Nginx proxy) there is no simple way to access the client's real remote address through env.

To get the real IP, you will have to get x-forwarded-for from :headers.

I am using Clack with Hunchentoot server.

From my understanding, the handler for Huchentoot should use :remote-addr (real-remote-addr req) instead of :remote-addr (remote-addr* req)

@fukamachi
Copy link
Owner

fukamachi commented Apr 1, 2017 via email

@asutoshpalai
Copy link
Author

I think you misunderstood my point. The X-Forwarded-For header is being set by Nginx properly. The problem lies in accessing the client's IP address reliably.

Currently, we can access the actual client's IP by doing something like

(or (gethash "x-forwarded-for" (getf env :headers))
    (getf env :remote-addr))

Instead, if it was accessible from something like with

(getf env :remote-addr)

or

(getf env :real-remote-addr)

then it will provide a stable interface to get the client's IP.

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

No branches or pull requests

2 participants