Jump to content

Possible to adjust the Client IP setting?


Alarion

Recommended Posts

This feature will probably only applies to a very minor customer population (maybe even just me) but, my WHMCS installation is hosted with Mosso.com. This is a cloud service. The way the servers are configured, the client IP that is reported by WHMCS when ordering and logging in and such, is *not* the real users IP. Instead, it is the IP of either a load balancer or some other server on the Mosso.com network.

 

I have attached a screenshot showing the difference using the PHPInfo tool inside WHMCS. Is there a way to change this now, or would it require new code (probably new code, huh)?

whmcs_client_ip.jpg

Link to comment
Share on other sites

That's standard for forwarded IPs; if WHMCS doesn't handle that it's not handling proxying correctly, and that could be considered a bug. REMOTE_ADDR is only valid if a proxy is not involved in the chain.

 

Here's a code fragment I found that explains what I mean a little more completely:

if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
  if ($_SERVER["HTTP_CLIENT_IP"]) {
  $proxy = $_SERVER["HTTP_CLIENT_IP"];
 } else {
  $proxy = $_SERVER["REMOTE_ADDR"];
 }
 $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
} else {
 if ($_SERVER["HTTP_CLIENT_IP"]) {
  $ip = $_SERVER["HTTP_CLIENT_IP"];
 } else {
  $ip = $_SERVER["REMOTE_ADDR"];
 }
}

(I'm not 100% sure about whether the HTTP_CLIENT_IP code should be included, but the rest is correct)

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated