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 17, 2008
You can "serve" a page from LTM using HTTP::respond 200 content $http_content:
when HTTP_REQUEST {
Check if request is for wpad.internal/wpad.dat
if {[string tolower "[HTTP::host][HTTP::uri]"] eq "wpad.internal/wpad.dat"}{
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"; }
}
}
}
Just escape the new lines in the payload with \. After you add the iRule, test it to make sure the content is as you expect and then run 'b load' to verify the LTM parser handles the meta-characters in the iRule correctly. Running 'b load' will reload the configuration so it shouldn't be done on a live box during production.
Aaron
Great news. Just to be sure - so I must do new virtual server with this iRule only, without pool or nodes, as F5 is my only pool and node and iRule catches all traffic sent to wpad.dat and serve this file?
And I put this VIP address into DNS and F5 will serve it easily? But how van I do alias, as due historical reason I have few aliases, like cache1.pac, cache2.pac, which all right point to the wpad.dat file being symlinks in one Linux apache server, which serves right now this wpad.dat.
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
