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 24, 2008This version would match the same host header values, but for a URI of /cache3.pac, it sends the proxygateway2.internal:8080 response:
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 for /wpad.dat, /cache1.pac"
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";}
}
}
"/cache3.pac" {
log local0. "[IP::client_addr]:[TCP::client_port]: Request matched URI check for /cache3.pac"
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 proxygateway2.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
