Ralph_David_201
Dec 25, 2017Nimbostratus
URI to lower case LTM irule issue
Hi Team,
I have a challenge to redirect all uri into lower case. I am able to redirect the URL to lower case but if i type in e.g myweb.net/fR/PAges/DEfauLT.aspx etc it does not redirect to lower case e.g myweb.net/fr/pages/default.aspx. I am trying my best but not sure where actually issue lies. Your help is very much appreciated.
when HTTP_REQUEST {
STREAM::disable
HTTP::path [string tolower [HTTP::path]]
if { [string tolower [HTTP::path]] equals "/" } {
if { [HTTP::header "Accept-Language"] starts_with "fr" } {
HTTP::respond 301 -nocase "Location" "https://www.myweb.net/fr/pages/default.aspx" Strict-Transport-Security "max-age=300
}
elseif { [HTTP::header "Accept-Language"] starts_with "en" } {
HTTP::respond 301 -nocase "Location" "; Strict-Transport-Security "max-age=300" }
} elseif { [string tolower [HTTP::path]] equals "/autodiscover/autodiscover.xml" } {
HTTP::respond 301 "Location" "https://autodiscover.myweb.net/autodiscover/autodiscover.xml"
HTTP::redirect "http://[HTTP::host][string tolower [HTTP::path]][HTTP::query]"
} elseif { [string tolower [HTTP::host]] contains "blog.myweb.net" }{
HTTP::respond 301 noserver "Location" "https://www.myweb.net/en/tech/pages/default.aspx"
} elseif { [string tolower [HTTP::host]] contains "techpage.myweb.net" }{
HTTP::respond 301 noserver "Location" "https://www.myweb.net/en/tech/Pages/techpage.aspx"
}
}
when HTTP_RESPONSE {
HTTP::header remove SPRequestGuid
set cookies [HTTP::cookie names]
foreach aCookie $cookies {
HTTP::cookie secure $aCookie enable
}
if { [HTTP::header exists Location] } {
HTTP::header remove Server
HTTP::header replace Location [string map {"http://" "https://"} [string tolower [HTTP::header Location]]]
}
if { [HTTP::header Content-Type] contains "text" } {
STREAM::expression { @http://s5.mywebnet.net@https://s5.mywebnet.net@ }
STREAM::enable
}
}