Re: content-sw-sample.cfg

From: Willy Tarreau <w#1wt.eu>
Date: Mon, 8 Oct 2007 17:40:25 +0200


Hy Bryan,

[I've concatenated your second mail at the end]

On Thu, Oct 04, 2007 at 06:07:06PM -0400, Bryan Germann wrote:
> examples/content-sw-sample.cfg provides the following example to send
> requests with /img/ and /css/ in the URI to the static backend:
>
> # The URI will use a specific keyword soon
> reqisetbe ^[^\ ]*\ /(img|css)/ static
> reqisetbe ^[^\ ]*\ /admin/stats stats
>
> This is correct, but misleading. A request header containing "Referer:
> http://www.example.com/img/" would send the user to the static backend even
> if they requested "http://www.yoursite.com/".
>
> I guess one solution would be:
> reqisetbe ^(GET|POST)\ /(img|css)/ static
> reqisetbe ^(GET|POST)\ /admin/stats stats
>
> But it would be nice to have a urlisetbe keyword.
[...]
> My mistake:
>
> reqisetbe ^[^\ ]*\ /(img|css)/ static
> works correctly (and as stated in the example)
>
> reqisetbe ^[^\ ]*\ .*/(img|css)/ static
> works as described in my first email (it will match the referer),
> which makes sense.

It's an error, you're right. The colon is missing. The rules should have been :

          # The URI will use a specific keyword soon
          reqisetbe       ^[^:\ ]*\ /(img|css)/    static
          reqisetbe       ^[^:\ ]*\ /admin/stats   stats

A solution involving only GET and POST would be wrong because you need to support at least HEAD and the RFC requires that you also support OPTIONS. And generally speaking, it's not desirable to have some methods reaching one farm and other methods reaching another farm for the same URI.

Regards,
Willy Received on 2007/10/08 17:40

This archive was generated by hypermail 2.2.0 : 2007/11/04 19:21 CET