Forum Discussion
kc2kth_49679
Nimbostratus
Feb 06, 2009Rewrite host and URI, then redirect
I thought I was pretty close on this one, but I can't quite get it to work. I need to rewrite a portion of a URI (drop part of the path and change the name of the page), change the host name, t...
kc2kth_49679
Nimbostratus
Feb 13, 2009So my requirements have changed a bit. I have the code below working. However what we now need to do is NOT send a redirect to the client and instead rewrite the uri portion of the request and send that to an existing server pool.
I'm confused about how to not pass the cached uri and instead pass what I've rewritten to the pool members. The host value should remain unchanged now.
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"app.domain.com" {
set host "www.google.com"
set uri [string map -nocase {"/path_to_replace" "/new_path" "index.jsp" "index.asp"} [HTTP::uri]]
HTTP::redirect http://$host$uri
}
}
}
I tried setting HTTP::uri and then using 'pool pool_name', but the original uri value seems to be passed, not what I've rewritten.
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