Forum Discussion
URI to lower case LTM irule issue
Redirection should be on F5 side for client requests with Upper case URI to Lower case URI.
e.g.
// config
[root@ve13a:Active:In Sync] config tmsh list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
translate-address enabled
translate-port enabled
vs-index 3
}
[root@ve13a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
if { [HTTP::uri] ne [string tolower [HTTP::uri]] } {
HTTP::respond 301 noserver Location http://[HTTP::host][string tolower [HTTP::uri]]
}
}
}
// test
[root@ve13a:Active:In Sync] config curl -I http://172.28.24.10/fR/PAges/DEfauLT.aspx
HTTP/1.0 301 Moved Permanently
Location: http://172.28.24.10/fr/pages/default.aspx
Connection: Keep-Alive
Content-Length: 0
[root@ve13a:Active:In Sync] config curl -I http://172.28.24.10/fr/pages/default.aspx
HTTP/1.1 404 Not Found
Date: Mon, 25 Dec 2017 08:53:27 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Fri, 15 Apr 2016 03:55:49 GMT
ETag: "418e44-6a-fc825b40"
Accept-Ranges: bytes
Content-Length: 106
Content-Type: text/html; charset=UTF-8
- Ralph_David_201Dec 25, 2017
Nimbostratus
Awesome nitass.From curl output i see it shows to lowercase but i see in browser URI remains in uppercase instead of redirected to lowercase.
- nitassDec 25, 2017
Employee
you may have to perform further troubleshooting such as tcpdump/ssldump, http analyzer tool or irule logging to see where the problem is.
- Stanislas_Piro2Dec 25, 2017
Cumulonimbus
I always recommend path-relative absolute URLs when destination page is on the same service as the current page:
when HTTP_REQUEST { if { [HTTP::uri] ne [string tolower [HTTP::uri]] } { HTTP::respond 301 noserver Location [string tolower [HTTP::uri]] } }the problem when working with absolute URLs is when a reverse proxy is configured in front of the server with another hostname or scheme, rewriting is required.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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