Search squid archive

Re: url_rewrite question

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

 



On 2014-02-12 13:38, Ricardo Klein wrote:
Hi,

I have a client who doesnt whant to remember his new internal web
system URL (ok, ok, but, he pays, he owns), so, he keeps using
http://online.publicdomain.com instead of
http://online.internaldomain.local

Following this documentation:
http://wiki.squid-cache.org/Features/Redirectors#Using_an_HTTP_redirector

I end to a perl script as this:
 #!/usr/bin/perl
 $|=1;
 while (<>) {
     chomp;
     @X = split;
     $url = $X[1];
     $url =~ s/publicdomain\.com/internaldomain\.local/;
     print $X[0]." 302:$url\n";
 }

But, I never have used the redirect_program on squid, and besides I
dont even know how to set a rule inside squid.conf. And, I havent find
nothing I could understand in how to set this up and send only the
right requests to it.

Can anyone help me with that?

When using a helper set url_rewrite_program or redirect_program to the path of the helper script. And use url_rewrite_access / redirect_access with ACLs to determine which HTTP requests it affects.


Alternatively if you have Squid-3.3 or later you can use deny_info to do the redirection without a helper at all. Just place this before any other allow lines in your http_access rules:

  acl redirectInternal dstdomain .publicdomain.com
  deny_info 302:%P://internaldomain.local%R redirectInternal
  http_access deny localnet redirectInternal

What that does is tell Squid that requests coming from the LAN (localnet IPs) going to *.publicdomain.com need to be "rejected" using a 302 status response pointing the client (browser) at the same URL with just internaldomain.local as the domain.

The user(s) can then type in either domain and will always get to the internal one when on the LAN.

Amos




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

  Powered by Linux