Proxy from and ordered list of web server until one of them send a 200 status code

Yann Malet yann.malet at gmail.com
Tue Aug 18 03:08:59 CEST 2009


Hello,

I am new to varnish and I end up on this mailing list after several days of
google search and a day of reading your documentation. Based on this small
experience I get the feeling that varnish might be the tool that I am
looking for. However I am not yet sure because I haven't found and example
of vcl configuration doing what I want.

Let me give you the context of this request we will soon replace our old cms
by a new one : both of them are served by 2 differents web server or on the
same web server but on 2 different port : weserver_new_cms:8081 and
webserver_old_cms:8082

What I would like to do is to have a single frontend web server called :
frontend:8080 that cache and the get the requested page from either
weserver_new_cms:8081 or webserver_old_cms:8082 and cache the result.

So the journey of the request will look like this :

Browser request the page :  *frontend:8080/foo/bar*
This request reach the frontend:8080, it looks if the page is the cache. If
the page is in the cache it serves it from there else it sends the request
to* weserver_new_cms:8081*. There are 2 cases there the page exists or  not.
If the page exists it serves the page to the frontend that puts it in the
cache and sends it to the client. If the page does not exist it means that
weserver_new_cms:8081 returns 404 the frontend should reverse proxy *to
webserver_old_cms:8082. *There is  again 2 cases there the page exists or it
doesn't. If the page exists it serves the page to the frontend that puts it
in the cache and send it to the client. If the page does not exist it
returns a 404 error to the client because the page does not exist in any
(new, old) cms.

It seems to me that *vcl_fetch* is the right place to hook this logic but so
far I have no idea on how to write this. Some help/ guidance would be very
appreciated.

Regards,
Yann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20090817/a28375a3/attachment-0002.html>


More information about the varnish-misc mailing list