ysbaddaden / prax

Rack proxy server for development
http://ysbaddaden.github.io/prax/
Other
475 stars 49 forks source link

Forwards the REMOTE_ADDR in the proxy #38

Closed fabiokr closed 10 years ago

fabiokr commented 11 years ago

Relates to ysbaddaden/prax#32

I was thinking if the proxy shouldn't be responsible from setting the REMOTE_ADDR header and forwarding that to the UNIX socket, as we have the address info at that time. Thoughts?

fabiokr commented 11 years ago

cc @ysbaddaden

ysbaddaden commented 11 years ago

The problem lies in Racker. It shouldn't try to set the remote addr header when the socket is a UNIXSocket (which make it the empty string) and instead make it "127.0.0.1", like if Prax and Racker talked through a local TCPSocket.

Prax is already setting the x forwarded headers, so that could fix the problems.

fabiokr commented 11 years ago

It isn't fixed yet, as the forwarded ip is empty (because of the UNIXSocket issue).

ysbaddaden commented 10 years ago

The unstable branch now sets the REMOTE_ADDR to 127.0.0.1 instead of the empty string when talking throught a UNIXSocket. Prax already sets the X_FORWARDED headers correctly, so applications will be capable to determine what thay trust.