OpenURI is a really useful part of the Ruby standard library. I never used it with basic authentication but I thought than specify credential in URL was enough. I was wrong. It returns an error:
ArgumentError: userinfo not supported. [RFC3986]
The right way to use auth params is a bit hidden in the documentation page. You can find it in the OpenRead open method as option.
http_basic_authentication: ["user", "password"])
If you run a commercial webapp, probably you have to track access.
CloudFlare helps you to manage more connection but hides from you many informations about the client. If you try to log the IP address you always get the CloudFlare’s ones.
Common headers which nginx uses to forward original IP (
X-Real-IP) contain the CloudFlare’s IP. The correct header where to look is
/* PHP */