Forum Discussion
kraigk_52257
Nimbostratus
May 02, 2014Moving IIS hosting.asp redirects to iRules
Need help moving IIS redirects to iRule. We have a long list of CNAME DNS records pointing to one IIS web server where we have a "hosting.asp" that does redirection. Some redirects are for sites an...
nitass
Employee
May 02, 2014e.g.
config
[root@ve11a:Active:In Sync] config tmsh list ltm data-group internal redirect_class
ltm data-group internal redirect_class {
records {
url1.company.com/ {
data /redirect.htm
}
url2.company.com/ {
data http://anyname1.company.com/services/directory
}
url3.company.com/ {
data https://anyplace2.company.compro/profile/Unsolicited/webpage.htm
}
}
type string
}
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
set hostpath [string tolower [HTTP::host][HTTP::path]]
if { [class match -- $hostpath starts_with redirect_class] } {
HTTP::redirect [class match -value -- $hostpath starts_with redirect_class]
}
}
}
test
[root@ve11a:Active:In Sync] config curl -Ik https://url1.company.com
HTTP/1.0 302 Found
Location: /redirect.htm
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11a:Active:In Sync] config curl -Ik https://url2.company.com
HTTP/1.0 302 Found
Location: http://anyname1.company.com/services/directory
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11a:Active:In Sync] config curl -Ik https://url3.company.com
HTTP/1.0 302 Found
Location: https://anyplace2.company.compro/profile/Unsolicited/webpage.htm
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
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