question regardaing Irule

Hi All

Maintenance page is hosted in server.When type in https://abc.com i am getting maintenance page . However Acessing https://abc.com/*,its not redirecting to the Maintenance page .

For example Typing https://abc.com/test ,i am getting page not found.

How to include for check for ANY string in HTTP URI so that able to redirect to Maintenance page

when HTTP_REQUEST {

if {[HTTP::uri] starts_with "/ "} {

HTTP::redirect "https://maintenancepage.com"

} }

Kindly suggest to resolve this

Thanks

Hi,

Here a typical example. I added some more code to show you how switch works and also the use of HTTP::respond as an alternative to HTTP::redirect :

when HTTP_REQUEST {
    switch -glob [HTTP::path] {
        "/test" {
            HTTP::redirect "https://test.com"
        }
        "/*" {
            HTTP::redirect "https://maintenancepage.com"
        }
        "/" {
            HTTP::respond 302 noserver "Location" "https://maintenacepage.com" "Cache-Control" "no-cache, must-revalidate"
        }
    }
}