Forum Discussion
Jakov_40007
Nimbostratus
Mar 26, 2010HTTP::path and HTTP::query question
I am new to iRules and having difficulty writing a rule that will rewrite a request from the client to a server by replacing the 'path' but will still retain the query string that follows. I have wri...
hoolio
Cirrostratus
Mar 26, 2010It looks like your rule should work to rewrite just the path (and preserve the query string). Can you add some logging to check?
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: Original [HTTP::method] request to [HTTP::host][HTTP::uri]\
with path [HTTP::path] and query [HTTP::query]"
if { [string tolower [HTTP::host]] equals "www.abc.com" } {
if { [HTTP::path] equals "/"} {
HTTP::path "/en-CA/default.htm"
}
}
}
when HTTP_REQUEST priority 501 {
log local0. "[IP::client_addr]:[TCP::client_port]: Current: [HTTP::method] request to [HTTP::host][HTTP::uri]\
with path [HTTP::path] and query [HTTP::query]"
}
The second HTTP_REQUEST event allows you to log any changes without having any problems with cached HTTP command output.
Aaron
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