/ Zope / Apsis / Pound Mailing List / Archive / 2010 / 2010-11 / redirecting all requests to the same domain

[ << ] [ >> ]

[ Does pound buffer data, i.e. can it spoon feed ... ] [ Re: [Pound Mailing List] redirecting all requests ... ]

redirecting all requests to the same domain
"Andreas" <lists(at)hilboll.de>
2010-11-27 13:24:43 [ FULL ]
Hello,

our organization has two domains, say domain1.com and domain2.com. We run
a website, and want to have all HTTP traffic to go via
http://domain1.com/. So we need to redirect
all incoming requests for any
other domain (for example, www.domain1.com, domain2.com, www.domain2.com,
...) to domain1.com. I tried this using a

   Service
     URL "!^http://domain1.com"
     Redirect 301 "http://domain1.com"
   End

But, apparently, this does not work. Perhaps one of you can help by
pointing me towards my mistake?

Oh, and a second question: We need to do the same for HTTPS, because our
SSL certificate is for the domain1.com domain. So the question is if the
redirect is applied *before* or *after* the traffic is encrypted (or,
rather, if the user going to domain2.com will be given a certificate
warning because the domain does not match, even though he will be
redirected to the correct domain).

Thanks for your insight!

Andreas.

Re: [Pound Mailing List] redirecting all requests to the same domain
Steve Amerige <pound(at)fatbear.com>
2010-11-27 13:16:58 [ FULL ]
Hi Andreas,

You can do:

    ListenHTTP
    Address x.x.x.x
    Port 80
    xHTTP 2
    Service
         HeadRequire "Host:\s*www\.domain1\.com.*"
         Redirect "http://www.domain1.com"
    End

    ListenHTTPS
    Address y.y.y.y
    Port 443
    xHTTP 2
    Ciphers "ALL:-ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP"
    Cert "/path/to/cert.pem"
    Service
         HeadRequire "Host:\s*www\.domain1\.com.*"
         Redirect "https://www.domain1.com"
    End

And similar for other redirections.  Enjoy!

Regards,

	
Steve Amerige, Fat Bear Incorporated <http://www.fatbear.com>
Web Engineering | Graphic Design | Creative Marketing
Website, Java, and Source-Code Hosting



On 11/27/2010 7:24 AM, Andreas wrote:[...]
Attachments:  
text.html text/html 4436 Bytes
fatbear-daruma-64-80.png image/png 1491 Bytes

Re: [Pound Mailing List] redirecting all requests to the same domain
"Andreas" <lists(at)hilboll.de>
2010-11-28 20:53:45 [ FULL ]
Hi Steve,

thanks for your answer! May I still ask what was wrong with my approach?
Wrong URL pattern? Or did I understand wrongly what URL parameter does? Or
something else entirely?

Thanks for your insight,

Andreas.
[...][...][...]

Re: [Pound Mailing List] redirecting all requests to the same domain
Robert Segall <roseg(at)apsis.ch>
2010-11-29 19:02:51 [ FULL ]
On Sun, 2010-11-28 at 20:53 +0100, Andreas wrote:[...]

Really a bit of both:

- the '!' does NOT denote negation in a regular expression, so your RE
would never match.

- the URL directive does NOT include the protocol/host part of the
request URL, but only the path and file. The host is indicated in the
'Host' header.[...]

Re: [Pound Mailing List] redirecting all requests to the same domain
"Andreas" <lists(at)hilboll.de>
2010-11-29 20:17:15 [ FULL ]
> On Sun, 2010-11-28 at 20:53 +0100, Andreas wrote:[...][...]

Merci :)

MailBoxer