t-roy
Nov 22, 2011Nimbostratus
inserting X-Origin-Host heade when using catch command
iRule's purpose:HTTP::header insert lws X-Origin-Host "[HTTP::host]"I know how to do this if I set a variable then add once my pool is selected, but I can't figure out how to do it using catch. Any help is appreciated!
rewrite some URIs to /
rewrite some hosts to start with www
send some URIs to my non-default pool but putting them in a data-group like "foo" := "foopool",
My problem: If my last if statement matches I would like to insert an X-Origin-Host header like so:
when HTTP_REQUEST {
if {[ class match -value [string toupper [HTTP::uri]] starts_with WWW-PREIMP.FOO.CA-URIREDIR] ne "" } {
HTTP::uri "/"
}
if {
[catch {[class match -value [string toupper [HTTP::host]] starts_with WWW-PREIMP.FOO.CA-PATHREDIR] } ]
} {
HTTP::respond 301 Location "]"
}
if {
[catch { pool [class match -value [string toupper [HTTP::uri]] starts_with FOO.CA-REDIR] } ]
} {
pool WWW-PREIMP.FOO.CA
}
}
Thanks!
Troy