ANS Documentation

Improve This Doc
  • Cloud
  • Domains and DNS management
  • Backup and High Availability
  • eCommerce Stacks
  • Security
  • Email
  • Monitoring and usage management
  • Networking
    • Content Delivery Network
    • Colocation
    • Firewalls
    • Classic Load Balancers
      • Quick-start
      • Frequently Asked Questions
      • Common Changes
      • SSL Passthrough vs Offloading
    • Load Balancers
    • Policy
    • How to set up a Multi-Protocol VPN Server using SoftEther
  • Operating systems
  • Webcelerator
  • MyUKFast
  • Home >
  • Backup and High Availability >
  • Classic Load Balancers >
  • Frequently Asked Questions

Frequently Asked Questions¶

A page dedicated to some of the more common questions related to our loadbalancers.

Why is all my traffic now coming from one IP?¶

Once you’ve moved behind a loadbalancer, you may notice that some of your analytics on your backend servers, along with your logs appear to break. Where you used to see a breakdown of all the visitors to your site, you now just see one persistent visitor. The numbers won’t have changed, but the IP address will have.

This is down to the nature of the loadbalancer itself. Where visitors used to directly visit your server, they now visit the loadbalancer instead and it’s the loadbalancer that makes requests to the backend server. As such, the only IP address you’ll see in logs or analytics will likely be that of the loadbalancer.

This obviously isn’t too great, but there’s an easy fix. Whereas logs and analytics will usually derive the visitor IP from the requests source, they need to be directed to look at the standard X-Forwarded-For header instead. This is injected by the loadbalancer automatically, so should already be present.

How this is achieved will depend on what solution you’re trying to work with. Here are a few examples:

Apache¶

Apache has an optional module called mod_rpaf that handles the transition from source to X-Forwarded-For, so with it set up you shouldn’t really notice any difference from that point onward.

It’s not installed by default, so install it like so:

  yum install mod_rpaf

After that, edit /etc/httpd/conf.d/mod_rpaf.conf and put the following content in:

  LoadModule rpaf_module modules/mod_rpaf-2.0.so

  RPAFenable On
  RPAFsethostname On
  RPAFproxy_ips 1.1.1.1 2.2.2.2 127.0.0.1
  RPAFheader X-Forwarded-For

Replace 1.1.1.1 and 2.2.2.2 with the IP address(es) your loadbalancer is sending traffic from and restart Apache to put it all live:

  service httpd restart

NGINX¶

The comparable module for NGINX is called ngx_http_realip_module: http://nginx.org/en/docs/http/ngx_http_realip_module.html

If your install of NGINX was compiled with --with-http_realip_module then you should be able to make use of it like so in your nginx.conf:

  set_real_ip_from 1.1.1.1;
  real_ip_header    X-Forwarded-For;

As mentioned for Apache, 1.1.1.1 should be replaced with the IP address that’s now sending all the traffic to your servers.

Then restart NGINX to put it live:

  service nginx restart

Next Article > Common Changes

  • Useful Links
  • SMB
  • Enterprise
  • Channel
  • Public Sector
  • ANS Data Centres
  • About ANS
  • Careers
  • Blog
  • Get in touch
  •  
  • Sales 0800 458 4545
  • Support 0800 230 0032
  • Get in touch

© ANS Group Limited | Terms and Conditions | Corporate Guidance | Sitemap
ANS Group Limited, registered in England and Wales, company registration number 03176761, registered office 1 Archway, Birley Fields, Manchester M15 5QJ