The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
load balancer/reverse proxy?
Hi, I help maintain the servers for a large vBulletin forum (usually 500-1000 concurrent users online), we currently have 3 servers (1 sql, 2 web servers running lighttpd) and recently had a hardware load balancer installed.
The problem is the load balancer acts as a reverse proxy, and vBulletin/the webservers see all requests as coming from the load balancers ip rather than the users ip - which means vBulletin sees everyone who isnt logged in already as the same user which means it's incredibly hard to login (due to people getting their password wrong etc), search, and keep track of users from their actual IP's. According to our datacenter the original source IP is sent to the webservers in the X-forwarded-for header, is there anyway to get vBulletin to use this header instead of the normal one it's using? |
#2
|
|||
|
|||
Anybody?
|
#3
|
|||
|
|||
Hi there,
I use a software load balancing but the idea is the same. You have to edit class_core.php and change from: /** * Fetches the IP address of the current visitor * * @return string */ function fetch_ip() { return $_SERVER['REMOTE_ADDR']; } To: /** * Fetches the IP address of the current visitor * * @return string */ function fetch_ip() { return (getenv(HTTP_X_FORWARDED_FOR)) ? getenv(HTTP_X_FORWARDED_FOR) : getenv(REMOTE_ADDR); } Also don't forget to edit your lighttpd configuration (lighttpd.conf) in order to log the user IP address. At this file you need to replace %h with %{X-Forwarded-For}i on the accesslog.format line. Example: From: accesslog.format = "%h To: accesslog.format = "%{X-Forwarded-For}i Cheers, Gabriel. |
#4
|
|||
|
|||
Thanks so much for posting this, even though it was over two years ago. This helped me greatly today.
|
#5
|
|||
|
|||
Very thanks
|
#6
|
||||
|
||||
Quote:
Thanks! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|