Forum Discussion
Todd_Jones_1074
Sep 18, 2012Nimbostratus
HTTP::redirect cause reset
Hello,
I've been given a requirement to ensure that a URI is passed to the web servers with the correct case. For example:
www.host.com/CASEmatters is correct
www.host.com/casematter or /CaSeMaTtErS need to be redirected to /CASEmatters.
I've tried HTTP::redirect, HTTP::uri and HTTP::respond. All of them result in a reset instead of a redirect.
Here is my iRule with the redirect. Any help you can provide will be appreciated.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/foo*" { pool foo }
"/bar*" { pool bar }
"/casematters*" {
switch -glob [HTTP::uri] {
Check URI for match to desired case "CASEmatters"
"/CASEmatters*" { pool casematters }
If it doesn't match then redirect
default { HTTP::redirect "https://[HTTP::host]/CASEmatters" }
}
}
default { pool default }
}
}
- Mohamed_LrhaziAltocumulusThey result in a "reset" as in "TCP reset" or connection closed? Weird!
- Kevin_StewartEmployeeI'd skip the nested switch evaluation and just trigger the casematters code if the [string tower [HTTP::uri] equals "/casematters". Also, assuming you don't need the client to actually see the different case in the address bar, just change the HTTP::uri on ingress.
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/foo*" { log local0. "foo pool" pool foo } "/bar*" { log local0. "bar pool" pool bar } "/casematters*" { log local0. "casematters pool" pool casematters set sub_uri [findstr [string tolower [HTTP::uri]] "/casematters" 12] log local0. "sub_uri = $sub_uri" HTTP::uri "/CASEmatters$sub_uri" } default { pool default } } }
- Todd_Jones_1074Nimbostratus
A TCP reset
- Mohamed_LrhaziAltocumulusI'd check the ltm logs.. that might mean the irule got a runtime error!
- Todd_Jones_1074NimbostratusNo runtime error in the logs.
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