Forum Discussion
Bertolazzi_7869
Apr 18, 2012Nimbostratus
HTTP Redirect: Hint or an example?
- nitassEmployeedo you want redirection or rewriting?
[root@ve1023:Active] config b virtual bar list virtual bar { snat automap pool server destination 172.28.19.79:8080 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve1023:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if { [HTTP::uri] equals "/ABC" } { HTTP::redirect "http://[HTTP::host]/DEF" } } } [root@ve1023:Active] config curl -I http://www.mydomain.com:8080/ABC HTTP/1.0 302 Found Location: http://www.mydomain.com:8080/DEF Server: BigIP Connection: Keep-Alive Content-Length: 0
- Michael_YatesNimbostratusHi Bertolazzi,
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/abc" } { HTTP::redirect [string map {"abc" "def"} [HTTP::uri]] } }
- Bertolazzi_7869NimbostratusNitass and Michael, tks for your reply!
- Bertolazzi_7869NimbostratusHi,
when HTTP_REQUEST {
if { [HTTP::uri] equals "/abc" } {
HTTP::redirect "http://[HTTP::host]/def"{
"/abc*" {pool pool_def}}}
if { [HTTP::uri] equals "/hij" } {
HTTP::redirect "http://[HTTP::host]/klm"{
"/hij*" {pool pool_klm}}
}
}
- Bertolazzi_7869NimbostratusHi,
- nitassEmployeei think Michael's irule is more general. by the way, you may combine two irules together.
[root@ve1023:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { switch [HTTP::uri] { "/ABC" { HTTP::redirect "http://[HTTP::host]/DEF" } "/HIJ" { HTTP::redirect "htt://[HTTP::host]/KLM" } "/DEF" { pool pool_def } "/KLM" { pool pool_klm } } } }
- Bertolazzi_7869NimbostratusNitass
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