Varnish Tips

I thought it would be a good idea to start a topic for tips on implementing varnish with elgg.

Here's one I just learned THE HARD WAY (rookie mistake).

If you start doing heavy caching (beyond just photos, videos and static content) make sure you do something to address the fact that ordinarily with the typical varnish+apache setup '127.0.0.1' will show up as the REMOTE_ADDR.  This then appears in your logs and certain plugins such as Spam Login Filter will get confused by it and it can cause all sorts of trouble potentially (like say when you ban 127.0.0.1). 

You need to do something like this:

http://mclear.co.uk/2011/09/09/how-to-install-mod_rpaf-varnish-wordpress-ubuntu/

Basically you have to setup a header like HTTP_X_FORWARDED_FOR and then configure apache to rewrite REMOTE_ADDR using the header by way of a module.  The proper module options and even how exactly to add the varnish part in your .vcl vary depending on versions.  It's a bit of a mess (different varnish versions, different versions of rpaf distributed with different Apache versions, and even alternate newer modules beyond Apache 2.4.x) but if you get an error Google/Bing it and you'll find the answer or ask here and I'll help if I can. :)

 

 

  • this is also required for incapsula to function correctly with ip tracing.. though i didn't get it functioning with my nginx install prior to leaving incapsula for other reasons.

Performance and Scalability

Performance and Scalability

If you've got a need for speed, this group is for you.