Forum Discussion
Mia_27938
Nimbostratus
Mar 13, 2014The question about the rewriting URI based on source IP
Hi all,
I Have a Standard VS with a http profile and the service domain is "http://www.abc.com"
I want to rewriting or replacing the URI based on source IP.
For example,
When the request...
Mar 14, 2014
Hi!
Everything is hard in the beginning. Keep trying and you'll get there. 🙂
The problem with your rule was this part:
HTTP::header replace Host "www.abc.com/go"
"www.abc.com" is the host, and "/go" is the URI so you must change them separately.
As per your description, try this one:
when HTTP_REQUEST {
if { [IP::addr [IP::client_addr] equals 10.10.10.0/24] } {
Do nothing to forward to the default pool
} else {
Replace the host
HTTP::header replace Host "www.abc.com"
set [string tolower [HTTP::uri]]
Check if the uri start with /go. If not, replace it with /go.
if { not $uri starts_with "/go"} {
HTTP::uri "/go"
}
}
}
Good luck!
/Patrik
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