Squid


(Eric Blanchi) #1

Hi,
just wondering if anybody has ever tried to use MySource Matrix served through a content accelerator such as Squid. If so, are they any recommendations for such a setup?


(Avi Miller) #2

We have a few clients who are running Matrix behind reverse proxies like Squid, Apache and others. I would recommend contacting Squiz Support directly so that we can discuss your requirements and provide an appropriate configuration.


(Andrew Lill) #3

I would also like to hear of people's experience with this.


I agree with Avi that posting of configuration files in a public forum is a little dangerous.


(Eric Blanchi) #4

Without posting config files, I was hoping to get some generic information.
My knowledge in Squid is fairly limited but I am currently testing a Squid box caching a MySource site on another box.



At the moment:

www.mysquidbox.com/

shows me the page served at

www.mysourcebox.com

but all the navigation points to www.mysourcebox.com. I'd like it to point to the Squid one. Is it something to do with the site URL or the System root, or is it Squid related?



Edited to remove the links to the dummy URL.


(Marcus Nyeholt) #5

That'll be because the matrix install doesn't have the www.mysquidbox.com as a url in its system. You could try putting it in as a system root and site url, not sure what'll happen though ;).


(Avi Miller) #6

We have configured Matrix behind Apache reverse proxy machines and I'm sure someone has done it with Squid. You need to ensure that whatever the external domain is (i.e. the one the user sees) is configured in Matrix.


(Eric Blanchi) #7

Just in case someone is interested… I've got the basics working.


I have a squid box which has two name-based virtualhosts, each virtual host serves a matrix site. Matrix is on a different box and has 3 different system root variables: itself as well as the two virtual hosts.



Thanks Marcus and Avi for your help. The harder bit seems to do all that needs to be done (essentially: squid setup, adding system root, and site url) in the correct order. If not, you run into some interesting behaviours such as loss of stylesheet in the admin interface and asset tree failing to load. As often, once it worked it all seemed obvious.



Now to the tricky bit: configuring the squid cache…


(Eric Blanchi) #8

Avi, using Apache as a reverse proxy, did you modify MySource in anyway to allow for caching of PHP? As in set some specific headers?


My Squid caches html, images, and other files no worries but anything PHP (be it MySource or a simple test.php) won't work. I'm assuming you must have ran into the same issues with Apache.


(Avi Miller) #9

I seem to recall forcing Apache to cache PHP files, but I can't recall the exact configuration option off the top of my head. At one stage, I wrote a simple modification to Matrix that calculated and sent proper cache/proxy-compliant 302 Not Modified HTTP headers, but the system was not complete or reliable. Essentially, it would work great on Standard Pages, but would not calculate the correct last-modified date for dynamic content like Asset Listings.


Though, I'm not sure we were that concerned with actual caching as opposed to simply proxying from multiple (or protected) webservers.


(Eric Blanchi) #10

Hi, just a small update: PHP seems to cache ok.
However MySource Matrix content still nothing.



Avi, you don't happen to have that bit of code handy? It would be a good starting point.

I'm a bit stumped at the moment…