Robert,

I've needed something like this for our service.  In our case, our SEO (search engine optimization) expert is telling me that google and other search engines give pages lower scores if the page appears on multiple URLs, even if in the same domain.  So if google sees www.somedomain.com/somepage.html and somedomain.com/somepage.html, they will give that page a lower score.  With pound I can do a 302 redirect, but he wanted a 301, and the only way I could do so is in IIS.  It would be better to have it in pound, instead of making a round trip to the backend.  At least thats my motivation.

Albert

Robert Segall wrote:
On Mon, 2007-09-24 at 16:00 +1000, Chris Barnett wrote:
  
Hi!

I just scratched a bit of an itch. I really wanted to be able to
configure pound to be able to send 301 or 307 redirects, not just
302s. So I wrote a patch to do just that.

It can be applied easily to 2.3.2, but also to 2.4d with 'patch -p1 -F
3' (sorry if this is obvious, see disclaimer below).

You can force a 301 Moved Permanently redirect like this:

        ListenHTTP
            Address 0.0.0.0
            Port    80

            Service
                HeadRequire "Host: .*www.server0.com.*"
                Redirect 301 "http://www.server1.com"
            End
        End

You can force a 302 Found or 307 Temporary Redirect in the same way.

The existing Redirect syntax still works as expected:

        ListenHTTP
            Address 0.0.0.0
            Port    80

            Service
                HeadRequire "Host: .*www.server0.com.*"
                Redirect "http://www.server1.com"
            End
        End

Will use a 302 Found redirect.

Hope it's useful to someone.

Disclaimer: I haven't submitted patches to any project before, but
I've tried to do all the right things.  Apologies in advance if I've
stuffed up, please be kind.
    

Thanks Chris. I'll have a look at the patches and if reasonable
incorporate them (or at least the idea) in the next release.

May I ask what your motivation is?