문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top