Link to own domain results in "Internal Server Error"

Hi,

just to finish this up. We’ve found the error in a patch we’ve applied. We had the same issue like described in this topic as we are using Azure Application Gateway V1.
In this post I described what we’ve did to work around this issue.

Anyway. It seems that request.ip is nil if you create a link to your own hostname so our workaround fails We’ve fixed it by wrapping it into a begin…rescue…end like this:

begin
  ip_port_split = request.ip.split(':')
  ip_only = ip_port_split.first
rescue
  ip_only = request.ip
end

We’re looking forward for the next rack update/release as it should/will handle those x-forwarded-for - headers correctly.

Thanks for your time and kind regards.
Sascha

2 Likes