[squid-users] Presenting an internal virtual host externally as domain root folder (Amos Jeffries)

Antony Stone Antony.Stone at squid.open.source.it
Fri Aug 14 10:41:45 UTC 2015


On Friday 14 August 2015 at 12:37:49, Antony Stone wrote:

> On Friday 14 August 2015 at 10:57:52, Arjen van der Meer wrote:
> > Good morning Amos,
> > 
> > And thanks for your reply. But I think this is what I already have
> > configured, unless you notice errors in the following configuration:
> > 
> > acl wordpress urlpath_regex ^/wordpress
> 
> The above matches any URL having "/wordpress" immediately after the
> hostname
> 
> > cache_peer 192.168.1.150 parent 80 0 no-query originserver name=ubuntu
> > cache_peer_access ubuntu deny wordpress
> 
> The above sends anything not starting with /wordpress to the Ubuntu
> machine.
> 
> > cache_peer 192.168.1.153 parent 80 0 no-query originserver
> > name=diskstation cache_peer_access diskstation allow wordpress
> > cache_peer_access diskstation deny all
> 
> The above sends the URLs starting with /wordpress to the Wordpress server,
> but only those URLs.
> 
> > And this works fine, but it only makes www.arjenvandermeer.eu/wordpress
> > available which is just part of what I want. What I'd like is this
> > website to be externally available as www.arjenvandermeer.eu without
> > rewrite or redirect,
> 
> What do you mean by "without rewrite or redirect"?
> 
> If you want a URL which does not contain "wordpress" to be served by a
> server which only has content under the directory "wordpress", then you
> *have* to have a rewrite somewhere along the way.
> 
> I would suggest creating two ACLs:
> 
> acl wordpress urlpath_regex ^/wordpress
> acl notroot urlpath_regex ^/..*

Actually, the .* is not required there - all you need is the ^/. to match a / 
and any other character immediately after the hostname.

> That second URL will match any URL with one or more characters after the /
> following the hostname (in other words, the *only* URLs it *won't* match
> are either the hostname itself, or the hostname plus a / and then nothing
> further).
> 
> Then you can use these to direct requests for /wordpress to the Wordpress
> server, anything else except the 'null' URL to the Ubuntu server, and the
> null entries to Wordpress (but you'll still have to have a redirect on the
> Wordpress machine so that http://server ends up serving content from
> http://server/wordpress):
> 
> cache_peer 192.168.1.150 parent 80 0 no-query originserver name=ubuntu
> cache_peer_access ubuntu deny wordpress
> cache_peer_access ubuntu allow notroot
> 
> cache_peer 192.168.1.153 parent 80 0 no-query originserver name=diskstation
> cache_peer_access diskstation allow wordpress
> cache_peer_access diskstation deny notroot
> cache_peer_access diskstation allow all
> 
> > while having www.arjenvandermeer.eu/zm and several other sites
> > still available on my Ubuntu system.
> 
> Regards,
> 
> 
> Antony.

-- 
Most people have more than the average number of legs.

                                                   Please reply to the list;
                                                         please *don't* CC me.



More information about the squid-users mailing list