|
/
Zope
/
Apsis
/
Pound Mailing List
/
Archive
/
2007
/
2007-09
/
[patch] Custom Redirect Types
[
Pound ratio question: load balancer to server ... ]
[
disabling a backend - any indication that this ... ]
[patch] Custom Redirect Types
"Chris Barnett" <barn3y(at)gmail.com> |
2007-09-24 08:00:09 |
[ SNIP ]
|
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.
Chris Barnett
|
|
|
|
|
Re: [Pound Mailing List] [patch] Custom Redirect Types
Robert Segall <roseg(at)apsis.ch> |
2007-09-25 16:31:05 |
[ SNIP ]
|
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?
--
Robert Segall
Apsis GmbH
Postfach, Uetikon am See, CH-8707
Tel: +41-44-920 4904
|
|
|
Re: [Pound Mailing List] [patch] Custom Redirect Types
Albert <pound(at)alacra.com> |
2007-09-25 16:52:32 |
[ SNIP ]
|
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?
>
|
|
|
|
|
Re: [Pound Mailing List] [patch] Custom Redirect Types
"Chris Barnett" <barn3y(at)gmail.com> |
2007-09-26 09:39:35 |
[ SNIP ]
|
Hi Robert,
My motivation was pretty simple: my company is putting pound in front of
apache for ease of scaling. Previously our apache configuration was doing
301 redirects, and I wanted to keep it that way. As Albert mentioned, it
could have an effect on SEO, and Google rankings are very important to our
business.
I did some searching on pound and redirects, and found Albert's thread from
December (
http://www.apsis.ch/pound/pound_list/archive/2006/2006-12/1166484055000),
including Adam's suggested modification. While that would fix the immediate
problem, I saw the real issue as the inability to configure pound to
optionally do 301 redirects.
The ability to handle 307 redirects was added when I read the comments about
them in the source. I figured why not give system admins the ability to
choose for themselves? As long as a sensible default is provided, of course.
So that, combined with a strange desire to do a bit of C hacking (strange
for me) suddenly resulted in a patch, and I thought I might as well submit
it.
BTW, congratulations on such well organized source! I had no trouble finding
or understanding any part of it.
Thanks,
Chris Barnett
On 9/26/07, Albert <pound(at)alacra.com> wrote:
>
> 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?
> >
>
>
> --
> To unsubscribe send an email with subject unsubscribe to pound(at)apsis.ch.
> Please contact roseg(at)apsis.ch for questions.
>
|
|
|
|
|
|