Forum Discussion
mart_58302
Nimbostratus
Aug 15, 2008Serving wpad.dat with F5?
Hello.
Maybe wrong area, but I'm trying to find out, is it possible to use F5 himself as web server, to serve text based file like wpad.dat or cache.pac for clients?
How ...
J-H_Johansen
Altostratus
Sep 19, 20179 years later...
I'm testing the LTM to server wpad/pac with irules and came up with this little script based on the response in this thread.
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"wpadtest.local" -
"wpad.local" {
set exp "function FindProxyForURL(url, host) {"
append exp "\n" "if(isPlainHostName(host)) return \"DIRECT\";"
append exp "\n" "if(shExpMatch(host, \"*\[^0123456789.\]*\") == false) return \"DIRECT\";"
append exp "\n" "if(isInNet(host, \"127.0.0.0\", \"255.0.0.0\")) return \"DIRECT\";"
append exp "\n" "if(isInNet(host, \"10.0.0.0\", \"255.0.0.0\")) return \"DIRECT\";"
append exp "\n" "if(isInNet(host, \"172.16.0.0\", \"255.240.0.0\")) return \"DIRECT\";"
append exp "\n" "if(isInNet(host, \"192.168.0.0\", \"255.255.0.0\")) return \"DIRECT\";"
foreach mm [class names dg_wpad_shExpMatch] {
append exp "" "if(shExpMatch(host, \"$mm\")) return \"DIRECT\";"
}
Last line
append exp "\n" "return \"PROXY proxy.local:80\";\n}"
HTTP::respond 200 content $exp "Content-Type" "application/x-ns-proxy-autoconfig"
}
default {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
}
}
The data group list dg_wpad_shExpMatch contains all the exceptions where the client must bypass the proxy.
In a production environment this will be used by at least 1000-2000 users daily. Is there any way I can cache the output and set a 600 seconds TTL on the contents? Is this a good way of doing it or should I find other ways of serving this script?
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
