diff --git a/lib/puma/client.rb b/lib/puma/client.rb index 8dc20c14..a856a00d 100644 --- a/lib/puma/client.rb +++ b/lib/puma/client.rb @@ -309,7 +309,7 @@ module Puma return @peerip if @peerip if @remote_addr_header - hdr = (@env[@remote_addr_header] || LOCALHOST_ADDR).split(" ").first + hdr = (@env[@remote_addr_header] || LOCALHOST_ADDR).split(/\s,/).first @peerip = hdr return hdr end diff --git a/lib/puma/dsl.rb b/lib/puma/dsl.rb index d69658be..ecf11f7e 100644 --- a/lib/puma/dsl.rb +++ b/lib/puma/dsl.rb @@ -311,7 +311,7 @@ module Puma # * header: http_header - set the remote address to the value of the # provided http header. For instance: # `set_remote_address header: "X-Real-IP"`. - # Only the first word (as separated by spaces) + # Only the first word (as separated by spaces or comma) # is used, allowing headers such as X-Forwarded-For # to be used as well. # * Any string - this allows you to hardcode remote address to any value