maintenance page redirection works for http but not https

this the irule used for http to https redirection

when HTTP_REQUEST { HTTP::redirect “https://abc.com/maintenance.html” }

when users try https it doesn’t work, if i set the same irule for https pool it gives me redirect loop, how can i set the redirection for https too?

Your irule will redirect ALL requests to /maintenance.html, including requests for /maintenance.html if this is irule is redirecting back to the same virtual server. You have to bypass the redirect for requests that are coming in for /maintenance.html(or any other objects that you don’t want redirected. The rule below will redirect all requests, except requests for /maintenance.html, to https://abc.com/maintenance.html This may not accomplish everything you desire, as there may be other objects on the page that you also have to bypass the redirect for.

when HTTP_REQUEST {
  switch -glob [string tolower [HTTP::path]] {
    "/maintenance.html" {
    }
    default {
    HTTP::redirect "https://abc.com/maintenance.html"
    }
}

The following would redirect for everything except /maintenance.html, /image1.png, and image2.png

when HTTP_REQUEST {
  switch -glob [string tolower [HTTP::path]] {
    "/maintenance.html" -
    "/image1.png" -
    "/image2.png" {
    }
    default {
    HTTP::redirect "https://abc.com/maintenance.html"
    }
}

Eric

Awesome, it works perfectly now… Thank you again for your help…

Hi, I still have issue for displaying the company image, it doesn’t display image on the webpage but everything else appears over http and https request. This is the irule i mapped to https VIP pool.

when HTTP_REQUEST { switch -glob [string tolower [HTTP::path]] { “/maintenance.html” - “/images/abcLogo.png” { } default { HTTP::redirect “https://abc.com/maintenance.html” } } }

What does the IMG reference in the HTML on maintenance.html look like?

If it has an absolute http://abc.com/images/abcLogo.png reference in the maintenance.html web page and you access it via HTTPS then this will likely cause issues as you’ll be referencing non-HTTPS content (image) directly from an HTTPS web page.

If this is the case, the simplest work-around is to change the IMG SRC link in the HTML to be relative “/images/abcLogo.png”.

Thanks Mike for your reply, the Image reference URL is - https://abc.com/images/abcLogo.png maintenance URL is - https://abc.com/maintenance.html

let me know if you need any more details..

Ahh, just noticed that you’re converting the HTTP path to lowercase and then comparing it to “/images/abcLogo.png” which contains uppercase characters. That’s not going to ever match! Just change that second switch condition to “/images/abclogo.png” (i.e. change the uppercase “L” to a lowercase “l”)