Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: ProxyPass does cache the data, but gives 502 when the real host dies...

From: Graham Leggett <minfrin(at)sharp.fm>
Date: Wed Mar 14 2001 - 16:43:02 EST

Jeroen Massar wrote:

> Boo :)

Aaaaaargh!!! Don't wake me up like that...!

> - The CacheRoot dir contains mangled filenames, could

The mangled filenames are designed for speed and uniqueness, as well as an even distribution across the filesystem - all performance issues.

> - It also caches it correctly, except for some non-static

On HTTP/1.0, it's the Pragma header (simply "Pragma: no cache"). The Expires header gives the time when the object becomes non-fresh, as will be revalidated.

Do you need help?X

On HTTP/1.1, it's the Cache-Control header, which has a whole lot of options, like no-cache (same as "Pragma: no-cache"), no-store, and a whole lot of others. Each object representation is represented by an Etag (electronic tag?) which is a unique string which changes when the object changes. This allows very fine control over whether an object is fresh or not.

> - Whenever I turn off box2, box1 will start spitting

In theory using the Expires header correctly should support this, but often browsers will send a conditional request for checking whether cached data has changed - and this ends up all the way at the backend which isn't there - so a bad gateway gets sent back up the chain.

This is something I am keen to sort out in the v2.0 mod_proxy - handling of dodgy or unreliable backend servers in a useful way. To do this though means doing some things that break HTTP/1.1, so they'll have to be special configuration options, and not the default.

One way of doing this is - when the "special mode" is on - replace a 502 Bad Gateway result from a conditional response with a 304 Not Modified. This way when the browser or the intermediate proxy asks "is my cached copy fresh" the Apache proxy will say "yes" - even though the backend server is toasted and there is no way of being sure.

There is nothing that can be done about normal requests - if the backend is dead and nothing is cached then there is nothing the browser can show (502 Bad Gateway). Sending a 404 is a bad idea - could send someone mailing in saying "the file is missing" when in fact the server was missing, sending admins on wild goose chases.

Regards,
Graham

-- 
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."
Received on Wed Mar 14 20:36:01 2001

This archive was generated by hypermail 2.1.8 : Thu Aug 24 2006 - 14:53:14 EDT

Do you need more help?X

Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library