Forum Discussion
DNSgeek_90802
Nimbostratus
Dec 28, 2009Get HTTP::uri in HTTP_RESPONSE
I have an irule that needs to get the URI from a 404 page and muck with it. However, when I try to reference [HTTP::uri], I get told that I cannot access it from the HTTP_RESPONSE context.
...
DNSgeek_90802
Nimbostratus
Dec 28, 2009Here's what I'm trying to do. I send a request to pool A. If and only if pool A returns a 404 code, I need to rewrite the path and send the request to pool B. No matter what pool B responds with, return it to the client.
So, in the HTTP_REQUEST section, we save off the [HTTP::path] into the variable $mypath. In the HTTP_RESPONSE section, we have:
when HTTP_RESPONSE {
if { $::DEBUG }{
log "respcode -> [HTTP::status]'"
log "host -> [HTTP::host]"
}
if { ([HTTP::status] == 404) } {
if { $mypath ends_with "/" }{
set mypath [string range 0 [string length $mypath]-1 $mypath]
append .html $mypath
}
HTTP::path $mypath
if { $::DEBUG }{
log "retruri -> $mypath"
}
pool B
}
}
The problem comes in the line
HTTP::path $mypath
THe error is:
01070151:3: Rule [myrule] error: line 34: [command is not valid in current event context (HTTP_RESPONSE)] [HTTP::path $mypath]
How can I change the path/uri so I can submit a request to pool B without forcing a redirect?
Tom
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