Search squid archive

Re: URL rewrite Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

You can try this in your squid.conf :

url_rewrite_program iRedirector.py
url_rewrite_children 1
url_rewrite_concurrency 20
url_rewrite_host_header off
Get and customize this files (this is template file )
https://ingeniweb.svn.sourceforge.net/svnroot/ingeniweb/iw.recipe.squid/trunk/iw/recipe/squid/templates/iRedirector.py_tmpl (rename iRedirector.py) https://ingeniweb.svn.sourceforge.net/svnroot/ingeniweb/iw.recipe.squid/trunk/iw/recipe/squid/templates/squidRewriteRules.py_tmpl (rename squidRewriteRules.py) And you configure in squidRewriteRules the redirection as mod rewrite (if you can) for apache.
rewrites = (
	(r'http://192.168.5.44:8380/(.*)',
       r'http://backendJBossserverIP:8080/portal/subdomain/\1', 'P,L'),
)
...

Regards Youenn.
Le 31 août 09 à 18:21, Trevor Merrill a écrit :

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@xxxxxxxxxxxx

 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@xxxxxxxxxxxx

 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



Youenn Boussard
INGENIWEB (TM) - SAS 50000 Euros - RC B 438 725 632
1, rue Royale
227, Les Bureaux de la Colline - Bat D
92213  - Saint Cloud Cedex
Tél : 01 78 15 24 00 / Fax : 01 46 02 44 04








[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux