Pergunta

I am running a WordPress site on IIS with a HAProxy running on Ubuntu 12.04 in front.

Problem is that the HAProxy hides the real IP for WordPress
This makes the WordPress only see like 10.12.3.50 from all users.

Is there anyone who has a fix for this. A plugin for WordPress, or a patch for the HAProxy?

Foi útil?

Solução

You can use the forwardfor option to get the original requestor's IP address in a X-Forwarded-For HTTP Request header.

I'm not sure if WP can be configured to log this header but for sure, it's in HAProxy's logs. It's very useful when troubleshooting.

Sources:

  1. https://serverfault.com/a/30336/101643
  2. personal experience

Outras dicas

Thanks for the Input. I will just explain some how I got it to work:

HAProxy change. Here I added these option to every redirect.

nano haproxy.cfg
 option httpclose
 option forwardfor

For the IIS I visited this page: http://blogs.iis.net/anilr/archive/2009/03/03/client-ip-not-logged-on-content-server-when-using-arr.aspx
Here I downloaded arr_helper_x86.zip (There is also an x64 bits version)
Then I just installed this on my IIS server, and viola I now see correct IP

Thanks to Ianthe for helping me out in correct direction.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top