Forum Discussion
Tim_Cahoon_1608
Nimbostratus
Jul 28, 2016URI Rewrite Help - Rookie
I am trying to do something I think is very simple:
when HTTP_REQUEST {
HTTP::redirect /broker/api/public[HTTP::uri]
}
I want to take an HTTP request coming in and put /broker/api/pubic in ...
Yann_Desmarest_
Nacreous
Jul 28, 2016Hi,
You can do the following :
when HTTP_REQUEST {
if { !([HTTP::path] starts_with "/broker/api/public") } {
HTTP::respond 302 Location "/broker/api/public[HTTP::uri]"
}
}
Yann_Desmarest_
Nacreous
Jul 28, 2016Hi,
The irule previously posted do a redirect on the client side. If you require to do URI rewriting, you will need to change the irule :
when HTTP_REQUEST {
if { !([HTTP::path] starts_with "/broker/api/public") } {
HTTP::uri "/broker/api/public[HTTP::uri]"
}
}
You may also have a look at the URI rewrite profile that has the advantage to rewrite response headers and payload to remove "/broker/api/public" for the client.
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