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 ...
hoolio
Cirrostratus
Oct 21, 2008Got it. Thanks for explaining once more. Do you want to send any response for requests which do not match your host/uri checking? If so, you can add another HTTP::respond command (I've put in placeholders but commented them out). This example should meet your requirements:
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: New request to [HTTP::host], [HTTP::uri]"
Check if requested Host header is wpad.internal
switch [string tolower [HTTP::host]] {
"cache.internal" -
"wpad.internal" {
log local0. "[IP::client_addr]:[TCP::client_port]: Request matched host check"
Host check matched. Now check the requested URI
switch -glob [HTTP::uri] {
"/wpad.dat*" -
"/cache1.pac" {
log local0. "[IP::client_addr]:[TCP::client_port]: Request matched URI check"
HTTP::respond 200 content {
function FindProxyForURL(url, host) {
if(shExpMatch(host, "*[^0123456789.]*") == false)
if( isInNet\(host, "127.0.0.0", "255.0.0.0")
|| isInNet(host, "172.17.0.0", "255.255.0.0")
|| isInNet(host, "172.18.0.0", "255.255.0.0")
)
return "DIRECT"; \
else
return "PROXY proxygateway.internal:8080; DIRECT";}
}
}
default {
Take some default action if the requested host matched, but the URI didn't?
HTTP::respond 400 content "Invalid URI"
}
}
}
default {
Take some default action if the requested host didn't matched?
HTTP::respond 400 content "Invalid host"
}
}
}
Aaron
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
