Forum Discussion
Rogerio_Teixeir
Nimbostratus
Apr 10, 2008Replace host based on file type
Hi,
Im trying to creat a irule that replace de hostname (FQDN) based on what fily type is request...
Like this:
Based on class images (jpg,gif,png...etc)
client...
Chris_Seymour_1
Apr 10, 2008Historic F5 Account
Rogerio,
If I understand correctly, you want to replace the host www.foobar.com with images.foobar.com.
For one file type you could do something simple like this:
when HTTP_REQUEST {
if { [HTTP::path] ends_with ".jpg" } {
HTTP::redirect "http://images.foobar.com[HTTP::uri]"
}
}
For multiple images types you should use a data group with matchclass for your images like this:
class images {
".bmp"
".gif"
".jpg"
".pdf"
".BMP"
".GIF"
".JPG"
".PDF"
}
when HTTP_REQUEST {
if { [matchclass [HTTP::path] ends_with $::images] } {
HTTP::redirect "http://images.foobar.com[HTTP::uri]"
}
}
Hope this helps.
Chris
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