Networking Forums

Networking Forums > Computer Networking > Linux Networking > Squid - Auto Proxy hrefs

Reply
Thread Tools Display Modes

Squid - Auto Proxy hrefs

 
 
[WAS]-Benny
Guest
Posts: n/a

 
      01-06-2004, 03:08 PM
Hi people,

We have a Squid proxy server set up for a few internal sites, but
don't use it for external browsing. I want to link from a page to both
proxied and non-proxied sites, withoout constantly changing the
browser to proxy settings.

Is there a way to change the href to point to the proxy for certain
and not for others. I believe this is more to do with the
functionality of Squid, hence the post here...

ie;
proxy server 1.1.1.1:111
proxied address 2.2.2.2
external www.xyz.com

so the normal would be

href=http://www.xyz.com
then proxied
href=http://1.1.1.1:111@2.2.2.2

or something?
also tried
http://1.1.1.1/login?http://2.2.2.2

Any ideas much appreciated.

Cheers

Jay
 
Reply With Quote
 
 
 
 
Heath Raftery
Guest
Posts: n/a

 
      01-06-2004, 11:39 PM
[WAS]-Benny <(E-Mail Removed)> wrote:
> Hi people,


> We have a Squid proxy server set up for a few internal sites, but
> don't use it for external browsing. I want to link from a page to both
> proxied and non-proxied sites, withoout constantly changing the
> browser to proxy settings.


Just to clarify - you want some HTML in a web page to provide a
link to another page. But, you want that HTML to instruct the
browser to use the proxy for some links and not for others?

If I've interpreted that right, then AFAIK, there is no way for
a HTTP server to instruct a client to use a proxy or not. You have
to do proxy settings client side.

That said, you can get very close with a PAC script (see below).

> Is there a way to change the href to point to the proxy for certain
> and not for others. I believe this is more to do with the
> functionality of Squid, hence the post here...


I don't think this has much to do with Squid. A proxy server just
proxies. It can't decide whether it should be used or not! On the
other hand, if your browser is set to use the proxy for every
connection, the proxy can probably just fetch external sites
without caching them, but that doesn't appear to be what you are
after.

> ie;
> proxy server 1.1.1.1:111
> proxied address 2.2.2.2
> external www.xyz.com


> so the normal would be


> href=http://www.xyz.com
> then proxied
> href=http://1.1.1.1:111@2.2.2.2


Okay, try this concept: put a PAC (proxy automatic configuration)
script on your internal webserver so it is accessible at, says,
http://1.1.1.2/proxy.pac. Then, depending on your browser (Mozilla
based definately do PAC), you should be able to enter a PAC
location or an automatic configuration script URL for proxy
configuration. Use the proxy.pac address you have setup.

Then, in the proxy.pac file (which is just plain Javascript), use
somthing like this:

function FindProxyForURL(url, host)
{
if (isPlainHostName(host) ||
isInNet(host, "2.2.2.2", "255.255.255.0"))
return "DIRECT";
else
return "PROXY 1.1.1.1:111; DIRECT";
}

Now, when your client tries to fetch a URL, it will run the
FindProxyForURL script, and decide for itself whether to use the
proxy or bypass it and fetch the resource DIRECTly.

> Any ideas much appreciated.


Hope that helps!
Heath
--
*--------------------------------------------------------*
| ^Nothing is foolproof to a sufficiently talented fool^ |
| Heath Raftery, HRSoftWorks _\|/_ |
*______________________________________m_('.')_m__ _______*
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Squid Proxy configuration for Gmail POP hk Linux Networking 0 10-27-2007 08:00 AM
understanding reverse proxy using squid query.cdac@gmail.com Linux Networking 0 04-28-2007 03:40 AM
Squid Proxy Setting sunraysir@gmail.com Linux Networking 3 07-16-2005 05:16 PM
Squid as PROXY for Local LAN Riverside17 Linux Networking 6 04-12-2005 06:22 PM
Re: trnasparent proxy with squid & iptables Florian St. Linux Networking 4 07-03-2003 08:49 PM



1 2 3 4 5 6 7 8 9 10 11