Forum Discussion
RiverFish
Altostratus
8 years agoConvert Microsoft rewrite rules to iRule
Greetings, all. Is anyone familiar with Microsoft rewrite rules? I'm hoping someone could convert these to an iRule. These rules sit on a Microsoft ARR server acting as a reverse proxy between the cl...
RiverFish
Altostratus
8 years agoHere is my attempt. I'm sure it needs help. Would appreciate if someone could take a look...
when HTTP_REQUEST {
If client IP matches allow the request and replace the host header.
if { [IP::addr [IP::client_addr] equals 280.34.72.0/26] } {
HTTP::header replace Host "server003.ab.abc.com"
}
Add a trailing slash to the url except if it contains a folder or filename.
set uri_base [URI::basename [HTTP::path]]
if {$uri_base equals ""} {
The URI::basename is /folder/
} elseif {$uri_base contains "."} {
The URI::basename is *.* file
} else {
HTTP::path "[HTTP::path]/"
HTTP::respond 301 "Location" "[HTTP::path]"
return
}
}
when HTTP_RESPONSE {
Strip host header.
if { [HTTP::host][HTTP::uri] equals "server003.ab.abc.com/KeyManager/[HTTP::uri]" {
HTTP::uri "/[HTTP::uri]"
Set relative paths.
} elseif { [HTTP::uri contains "/[HTTP::uri]" }
HTTP::uri "/[HTTP::uri]"
}
}
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