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.htm...
mr_skater99_640
Jul 26, 2011Nimbostratus
I've found my problem - maybe someone can explain to me why i'm seeing this...
I had two rules applied to the vip - both very similar. This is because we have two reasonably large and reasonably different PAC files. So to keep them separate i created a rule for each PAC file.
Apart from defining the PAC file differently in each, the other difference was the http_request block. I did this so if anyone requested something other than the PAC file URL they would get a nice 404.
The first rule applied to the vip just had the above http_request block, but the second one had this:
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/proxy/pacfile2.pac"} {
HTTP::respond 200 content $static::pacfile "Content-Type" "application/x-ns-proxy-autoconfig" "pragma" "no-cache"
} else {
HTTP::respond 404 content {These are not the pages you are looking for...}
}
}
I changed this to:
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/proxy/pacfile2.pac"} {
HTTP::respond 200 content $static::pacfile "Content-Type" "application/x-ns-proxy-autoconfig" "pragma" "no-cache"
}
HTTP::respond 404 content {These are not the pages you are looking for...}
}
Same result. But as soon as i comment out the 404 line like so:
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/proxy/pacfile2.pac"} {
HTTP::respond 200 content $static::pacfile "Content-Type" "application/x-ns-proxy-autoconfig" "pragma" "no-cache"
}
HTTP::respond 404 content {These are not the pages you are looking for...}
}
Both PAC files are served up in their entirety. What is the 404 line doing that is breaking the rule from sending the whole PAC file?
Cheers,
Scotty
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