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 ...
mart_58302
Nimbostratus
Oct 21, 2008
Got 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:
Super! But I got errors when adding it into my code, so I just tried Your raw code and error is:
01070151:3: Rule [wpad_host_and_file_aliases] error:
line 5: [wrong args] [switch [string tolower [HTTP::host]]{ ]
line 7: [undefined procedure: cache.internal] ["cache.internal" - ]
line 8: [undefined procedure: wpad.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"
}
}
} ]
line 36: [undefined procedure: default] [default {
Take some default action if the requested host didn't matched?
HTTP::respond 400 content "Invalid host"
} ]
line 40: [unmatched closing character] [}]
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
