Forum Discussion
andrew_deackes_
Nimbostratus
Feb 25, 2014pac file i-rule with variable proxy?
Hi,
I found this article very interesting:
https://devcentral.f5.com/wiki/irules.Proxy_Pacfile_Hosting_without_need_for_Web_servers.ashx
however I'd like to do something slightly more ...
andrew_deackes_
Nimbostratus
Feb 28, 2014Success!!!! With datagroups defined and a little trial and error (didn't like a - in the pac file names) I can now server 3 pac files from one i-rule for 3 different regions:
when RULE_INIT {
set pacfileindia {
}
set pacfiletunis {
}
set pacfile {
} } when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/proxy.pac" {
if {[class match [IP::client_addr] equals india-pac]} { HTTP::respond 200 content $::pacfileindia "Content-Type" "application/x-ns-proxy-autoconfig" "pragma" "no-cache"} elseif {[class match [IP::client_addr] equals tunis-pac]} { HTTP::respond 200 content $::pacfiletunis "Content-Type" "application/x-ns-proxy-autoconfig" "pragma" "no-cache"} else { HTTP::respond 200 content $::pacfile "Content-Type" "application/x-ns-proxy-autoconfig" "pragma" "no-cache"}
}
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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