Re: [squid-users] Re: Squid3 Reverse Proxy based on url path

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sat, 22 May 2010 00:48:49 +1200

rainolf wrote:
> Hi,
> I've changed my configuration and now seem to work like i want....I
> eliminate the fake url and replaced with right dns records....
>
> This is my configuration:
>
>
> http_port 80 vhost vport=90 protocol=http defaultsite=webportal.domain.com
> acl http proto http
> acl port80 port 80
> acl domain2_com dstdomain world.webmail.domain.com
> acl domain1_com dstdomain italy.webmail.domain.com
> #acl domain3_com dstdomain webportal.domain.com
> acl hrm urlpath_regex ^/dbghrm
> acl fax urlpath_regex ^/avantfax
> acl ftp urlpath_regex ^/webftp
> acl portal urlpath_regex ^/webportal
>
> http_access allow all
>
> cache_peer xxx.xxx.xxx.xxx parent 80 0 no-query originserver name=domain1
> cache_peer_access domain1 allow domain1_com
>
> cache_peer xxx.xxx.xxx.xxx parent 80 0 no-query originserver name=domain2
> cache_peer_access domain2 allow domain2_com
>
> #cache_peer xxx.xxx.xxx.xxx parent 90 0 no-query originserver name=domain3
> #cache_peer_access domain3 allow domain3_com
>
> cache_peer xxx.xxx.xxx.xxx parent 8080 0 no-query originserver name=domain4
> cache_peer_access domain4 allow portal
> cache_peer_access domain4 deny all
>
> cache_peer xxx.xxx.xxx.xxx parent 80 0 no-query originserver name=dbghrm
> cache_peer_access dbghrm allow hrm
> cache_peer_access dbghrm deny all
>
> cache_peer xxx.xxx.xxx.xxx parent 80 0 no-query originserver name=dbgfax
> cache_peer_access dbgfax allow fax
> cache_peer_access dbgfax deny all
>
> cache_peer xxx.xxx.xxx.xxx parent 80 0 no-query originserver name=ftpweb
> cache_peer_access ftpweb allow ftp
> cache_peer_access ftpweb deny all
>
>
>
> access_log /var/log/squid3/access.log squid
>
> http_access allow http port80 domain2_com domain1_com portal
> http_access allow fax
> http_access allow ftp
> http_access allow hrm
>
> dns_nameservers xxx.xxx.xxx.xxx
>
> Like i said in previous days i would like to place an instance of apache
> server on reverse proxy in order to have a small page where put links to all
> internal webserver proxied by squid.
>
> in few words i will have apache with a small webpage and squid3 on the same
> server .
>
> My problem is :
>
> How can i do to open only one port ( ex. 80 ) on firewall in order to have
> the webpage with links without having problem to forward requests to
> internal web servers the listen on the same port?

Your squid is already solving this problem. Squid receives all port 80
traffic and routs the requests to whichever server you like to handle it.

>
> Can i make squid to forward the request on port 80 to internal webserver
> even if also apache is listening on that port?

No. For apache on the same machine as squid you need to give apache the
localhost IP address (127.0.0.1 etc) and treat it as just another
cache_peer source.

Squid may need a slight config alteration to add the public interface
address to the http_port line. To prevent it grabbing the localhost
address if started first.

" http_port $public_ip:80 " instead of "http_port 80 "...

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.3
Received on Fri May 21 2010 - 12:48:57 MDT

This archive was generated by hypermail 2.2.0 : Fri May 21 2010 - 12:00:05 MDT