Forum Discussion
Luca_55898
Jul 05, 2011Nimbostratus
Using an iRule for a proxy pac file
Trying to get an iRule working to deploy a proxy pac file.
I have been reading this link http://devcentral.f5.com/wiki/default.aspx/iRules/Proxy_Pacfile_Hosting_without_need_for_Web_servers.html and have created the iRule below based on the version 10 source in the link above.
So I understand that the 'return DIRECT' will bypass the proxy for all the sites listed in the shExpMatch section. But what about going onto the internet, which section of the iRule determines that www.microsoft.com for example needs to be assigned proxy1.ourbusiness.com?
Also, the devcentral link above says to just create the VIP but do not assign any pool, is that correct?
So apart from my questions above, does the rule below look OK? If i just point a client to the IP of the vip on whatever port the VIP listens on, such as http://192.1.1.1:8080/proxy.pac will that work?
when RULE_INIT {
set static::pacfile {
function FindProxyForURL(url, host) {
if (isPlainHostName(host))
return "DIRECT";
if (shExpMatch(url,"*.messages.*") ||
shExpMatch(url,"*remote.ourbusiness.com.au*") ||
shExpMatch(url,"*ww.ourbusiness.com.au*"))
shExpMatch(url,"*gobusiness.*") ||
shExpMatch(url,"*firstcust.*") ||
shExpMatch(url,"*longday.*") ||
shExpMatch(url,"*rosshome.*") ||
shExpMatch(url,"*ourbusiness.com*") ||
shExpMatch(url,"*portal.ourbusiness.com.au*") ||
shExpMatch(url,"*ourbusiness.com.au*") ||
shExpMatch(url,"*w2.ourbusiness.com.au*") ||
shExpMatch(url,"*w3.ourbusiness.com.au*") ||
shExpMatch(url,"*msgpooled.com*") ||
shExpMatch(url,"*corporateorders.com*") ||
shExpMatch(url,"*generic.com.au*") ||
shExpMatch(url,"*.ecommerce.com*") ||
shExpMatch(url,"*.paymentpage.com*") ||
shExpMatch(url,"*.mpt.com.*") ||
shExpMatch(url,"*.customercentral.com*") ||
shExpMatch(url,"*.informatic.com*"))
return "DIRECT";
if (dnsDomainIs(host, ".extranet.com")||
dnsDomainIs(host, ".extranet2.com"))
return "Proxy proxy1.ourbusiness.com:8080";
if (dnsDomainIs(host, ".intrant.com")||
dnsDomainIs(host, ".intranet2.com"))
return "DIRECT";
return "PROXY proxy1.ourbusiness.com:8080";
}
}
}
when HTTP_REQUEST {
switch [HTTP::uri] {
"/proxy.pac" {
HTTP::respond 200 content $static::pacfile "Content-Type" "application/x-ns-proxy-autoconfig" "pragma" "no-cache"
}
}
}
- The_BhattmanNimbostratusHi Luca,
- Luca_55898NimbostratusThanks for the reply.
- The_BhattmanNimbostratusHi Luca,
- Luca_55898NimbostratusThat has not helped :-(
- The_BhattmanNimbostratusHi Luca,
function FindProxyForURL(url, host) { return "PROXY proxy1.ourbusiness.com:3128"; } } }
- Ryan_Paras_7933NimbostratusLuca-
- The_BhattmanNimbostratusGood catch Ryan
- mr_skater99_640NimbostratusHi Guys,
- Ryan_Paras_7933NimbostratusNot that I believe it will make a difference ... but would you like the try the following:
- mr_skater99_640NimbostratusI've found my problem - maybe someone can explain to me why i'm seeing this...
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects