Forum OpenACS Q&A: Re: OpenACS with virtual hosting

Collapse
Posted by Dion Sweat on
From http://www.apsis.ch/pound/

<snip>

VIRTUAL HOSTS (IN GENERAL)

Some people asked about the possibility of redirecting requests to back-ends as per some virtual hosts definition. While I believe this is not Pound's job, it can be done. As of version 0.10, Pound supports filtering requests based not only on the request URL, but also on the presence or absence of certain headers.

Let's assume that you have internal server 192.168.0.10 that is supposed to serve the needs of virtual host www.server0.com and 192.168.0.11 that serves www.server1.com. You want Pound to listen on address 1.2.3.4 and separate the requests to each host. The config file would look something like this:

        ListenHTTP  1.2.3.4,80

        UrlGroup    ".*"
        HeadRequire Host    ".*www.server0.com.*"
        BackEnd    192.168.0.10
        EndGroup

        UrlGroup    ".*"
        HeadRequire Host    ".*www.server1.com.*"
        BackEnd    192.168.0.11
        EndGroup

(add whatever else is necessary) or, if you want even safer filtering:

        ListenHTTP  1.2.3.4,80

        UrlGroup    ".*"
        HeadRequire Host    ".*www.server0.com.*"
        HeadDeny    Host    ".*www.server1.com.*"
        BackEnd    192.168.0.10
        EndGroup

        UrlGroup    ".*"
        HeadRequire Host    ".*www.server1.com.*"
        HeadDeny    Host    ".*www.server0.com.*"
        BackEnd    192.168.0.11
        EndGroup

This is NOT recommended (I personally believe that virtual hosts should be implemented in the back-end servers - putting this in a proxy is a major security kludge) but it works.

</snip>

Sounds like the author doesn't think it's a good idea?...

Collapse
Posted by Andrew Piskorski on
I don't know what the maintainer (Robert Segall, presumably) of the Pound website was smoking when he wrote that "don't do virtual hosting" stuff above, as AFAICT it is nonsense. If you're going to do virtual hosting based on the HTTP "Host:" header, Pound (or one of its competitors) appears to be the ideal place to do that.

Btw, I hear that Pound is excellent, lots of folks here who should know use and are happy with it. Also, a while back they also fixed the "HTML streaming" problem pretty quickly after some folks here or on the AOLserver list (I forget which) raised the issue, which was very pleasant. The fact that one of it's maintainers appears to have a few blinders on when it comes to host based virtual hosting shouldn't do any serious harm...