Forum Discussion
elvisc_26948
Nimbostratus
Jan 05, 2010redirect/return a diff url without client action
Is there a way to return/redirect a different URI back to client but without aborting the session i.e no client action required.
eg:
http:xyz.com/URI_1
http request {
return/redirect (but completely transparent to client):
http://xyz.com/URI_2
}
next http request event:
[host::uri] should show --> http://xyz.com/URI_2
3 Replies
- The_Bhattman
Nimbostratus
Hi Elvisc,
if I understand you correctly you could do the following:when HTTP_REQUEST { if { [HTTP::uri] eq "/uri_1" } { HTTP::uri /prefix[HTTP::uri] } }
This would change the URI w/o the client ever seeing the change in the URI
Was this what you were looking for?
Bhattman - elvisc_26948
Nimbostratus
thanks for the quick response... I have tried a few other methods including yours before... which basically replace the uri from LB to the server side.
What I really want to achieve is:
eg the sequence of requests looks like this:
http://xyz.com/URI_1
http://xyz.com/URI_2
"
"
http://xyz.com/URI_X
http://xyz.com/index
http://xyz.com/URI_1
"
"
http://xyz.com/URI_X
http://xyz.com/index
"
"
I want to always capture at the point where index request comes in first before I read
the URIs.
---------------------------------------------------
Currently I am trying to do it using this technique:
when RULE_INIT {
global var so all subsequent sessions can check if index is requested first
set ::INDEX_READ "TRUE"
log local0. "RULE INIT ==> $::INDEX_READ"
}
when HTTP_REQUEST {
if (http::uri is index) and (INDEX_READ is FALSE) {
do something URI manipulation
set ::INDEX_READ "FALSE"
}
if (INDEX_READ is FALSE) {
if { [HTTP::uri] eq "/URL_1" } {
do something other string manipulation
HTTP::uri /prefix[HTTP::uri]
}
}
}
Trying that now and will let you know how it goes... - elvisc_26948
Nimbostratus
Adding another side question to my previous response...
when I do:
HTTP::path [string map ch1 ch4" [HTTP::path]]
log local0. "========>> HTTP_Path: [HTTP::path] HTTP_URI:"
output:
========>> HTTP_Path: path/path/ch1/file
I am still seeing ch1 in the output....Shouldn't it print out ch4 instead?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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