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

Forward REMOTE_ADDR when using unix socket #309

Closed
masterkain opened this issue Jul 7, 2013 · 2 comments
Closed

Forward REMOTE_ADDR when using unix socket #309

masterkain opened this issue Jul 7, 2013 · 2 comments

Comments

@masterkain
Copy link

I'm trying Puma 2.3.1 migrating from Rainbows! and found out that some of my API endpoints were returning 500.

The gem better_errors acts a middleware and at some point does this:

      return true unless env["REMOTE_ADDR"]
      ip = IPAddr.new env["REMOTE_ADDR"]
      ALLOWED_IPS.any? { |subnet| subnet.include? ip }

This exception occurs: IPAddr::InvalidAddressError because I found out env["REMOTE_ADDR"] being an empty string, but only from requests coming in from the unix socket, when using the direct http interface this value is present.

I agree that the gem might need a better check, though it allowed to uncover this behavior.

@evanphx
Copy link
Member

evanphx commented Jul 9, 2013

REMOTE_ADDR needs to represent the direct client. I guess for a unix client I could put 127.0.0.1 in there...

@masterkain
Copy link
Author

Yes, that would work, it's 127.0.0.1 also in rainbows.

@evanphx evanphx closed this as completed in 2717306 Jul 9, 2013
MSP-Greg added a commit to MSP-Greg/puma that referenced this issue Aug 5, 2020
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