Hello,
I am looking for some iRule help. I need to be able to passthrough a URL to backend servers that has any path or parameters (this might be default, not sure). For example, https://myexample.com/path/go would be get passed through to backend servers.
If the request comes in without a path/query/paramters, for example it will get redirected to a different url, for example https://redirecturl.com
Thanks!
Try this (untested):
when CLIENT_ACCEPTED {
set DEFAULT_POOL [LB::server pool]
}
when HTTP_REQUEST {
if { ( [string tolower [HTTP::host]] eq "myexample.com")} {
if { not ([HTTP::uri] eq "/") } {
HTTP::respond 301 Location "https://redirecturl.com/"
} else {
pool $DEFAULT_POOL
}
}
}
Hi,
Here an irule example :
when HTTP_REQUEST {
if { [HTTP::uri] eq "/" and [HTTP::query] eq "" } {
HTTP::respond 301 Location "https://redirecturl.com/"
}
}