[squid-users] URL rewrite Help

From: Trevor Merrill <tmerrill_at_navigationnorth.com>
Date: Mon, 31 Aug 2009 09:21:11 -0700 (PDT)

I am currently testing squid in a reverse proxy configuration with JBoss
Portal backend servers. My goal is to phase out Apache and mod_proxy and
gain some speed with squid. I have a basic reverse proxy configuration
working for www.mydomain.com but I need to try and duplicate the
following in squid:

(Apache conf example)
<VirtualHost *:80>
  ServerName subdomain.mydomain.com
  ServerAlias *.subdomain.mydomain.com
  ServerAdmin webmaster_at_mydomain.com

  ProxyRequests Off
  ProxyPreserveHost On

  <Proxy *>
   Order deny,allow
   Allow from all
  </Proxy>

  RewriteEngine On
  RewriteRule .* - [E=DEFAULT_PORTAL:subdomain]
  RewriteCond %{REQUEST_URI} ^/?$
  RewriteRule .* http://192.168.5.44:8380/portal/%{ENV:DEFAULT_PORTAL} [P,L]

  ProxyPass / http://192.168.5.66:8380/
  ProxyPassReverse / http://192.168.5.66:8380/

  ErrorLog /var/log/apache2/error.log
  LogLevel warn
  CustomLog /var/log/apache2/access.log combined
</VirtualHost>

Is it possible to do this sort of rewriting in squid? Essentially all I
am doing is changing the HTTP request from http://subdomain.mydomain.com
-> http://backendJBossserverIP:8080/portal/subdomain, the host stays the
same so the public sees http://www.mydomain.com/portal/subdomain. I am
having a tough time finding examples or some direction to start heading in.

For fun here is my current squid conf and the corresponding Apache conf
that I was able to essentially replace:

(Apache conf snippet)
<VirtualHost *:80>
  ServerName www.mydomain.com
  ServerAlias mydomain.com
  ServerAdmin webmaster_at_mydomain.com

  ProxyRequests Off
  ProxyPreserveHost On
  <Proxy *>
   Order deny,allow
   Allow from all
  </Proxy>

  ProxyPass / http://192.168.5.66:8380/
  ProxyPassReverse / http://192.168.5.66:8380/

  ErrorLog /var/log/apache2/error.log
  LogLevel warn
  CustomLog /var/log/apache2/access.log combined
</VirtualHost>

(Squid conf snippet)
> cache_peer 192.168.5.66 parent 8080 0 no-query no-digest originserver
> name=testerJBoss
> acl TesterJBoss_sites dstdomain .mydomain.com
> cache_peer_access testerJBoss allow TesterJBoss_sites
> http_access allow TesterJBoss_sites
> http_access deny All
Thanks for the help.

Trevor Merrill
Received on Mon Aug 31 2009 - 16:21:39 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 01 2009 - 12:00:04 MDT