Forum Discussion
Ralph_David_201
Nimbostratus
Apr 20, 2016irule issue - URI Case
Dear Forum,
I have a strange issue that below mentioned irule works fine for converting all upper case letters in uri and hostname when http request is received but when https request with any u...
Stanislas_Piro2
Cumulonimbus
Apr 21, 2016Hi,
You can try this irule:
when HTTP_REQUEST {
STREAM::disable
set path [string tolower [HTTP::path]]
set host [HTTP::host]
HTTP::path $path
switch -glob $path {
"/" {
if { [HTTP::header "Accept-Language"] starts_with "fr" } {
HTTP::respond 301 "Location" "https://www.mylocalnet.com/fr/pages/default.aspx"
}
}
"/insidecontent/insidecontent.xml" {
HTTP::respond 301 "Location" "https://insidecontent.mylocalnet.com/insidecontent/insidecontent.xml"
}
"*/hr-dept/*" {
HTTP::respond 301 noserver Location "https://[HTTP::host][string map -nocase {hr-dept hr-depart} $path]"
do not include protocol and host in redirect if hosted on the same base URL.
HTTP::respond 301 noserver Location "[string map -nocase {hr-dept hr-depart} $path]"
}
}
when HTTP_RESPONSE {
if { [HTTP::header is_redirect]} {
Replace absolute URL by relative URL to remove both hostname and protocol
HTTP::header replace Location [string map "http://$host/ /" [HTTP::header value Location]]
} elseif { [HTTP::header Content-Type] contains "text" } {
Replace absolute URL by relative URL to remove both hostname and protocol. This does not rewrite links to others URLs which were rewritten by previous irule
STREAM::expression "@http://$host/@/@ "
Replace absolute URL by relative URL to remove both hostname and protocol and rewrite URLs.
STREAM::expression "@http://$host/@/@ @http://s5.ccaduae.ae@https://s5.ccaduae.ae@ @preprod.ccaduae.ae@www.mylocalnet.com@ @http://www.mylocalnet.com@https://www.mylocalnet.com@"
STREAM::enable
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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