Topic: Problems with new site

Hi,
I have just installed punBB on a site with a lot of traffic. I am having some serious problems with the forum. Things are strange, and users are being forwarded to weird places after login. Simple bans affect all users etc.

I think the forum is confused by me using Varnish, even if I at the moment are not caching anything at all. I am just passing stuff directly through to the web-server.

One of the things that a passthrough does however, is that it changes the ip-address of the request. $_SERVER['REMOTE_ADDR'] is the ip of the server, while $_SERVER['X-FORWARDED-FOR'] is the real ip of the user. Could this be messing up things with punBB?

Any ideas about how to fix it?

Re: Problems with new site

Answering my own question, since it is solved now. Found a very easy way of fixing this in one af the Varnish support forums.

Make a simple php-script like this:

<?php
if( isset( $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] ) ) {
  $_SERVER[ 'REMOTE_ADDR' ] = $_SERVER[ 'HTTP_X_FORWARDED_FOR' ];
}?>

You can either include this at the top of your header-files, or even easier, you can add the following line to apache:

php_value auto_prepend_file "/var/www/varnishfix.php"

You could for instance place this under one of the

<Directory "/var/www/">...</Directory>

in your site-configuration. Or probably even in your .htaccess-file

This way no changes to the punBB-code is needed.