Avec la méthode HTTP_REQUEST

when HTTP_REQUEST {
    #
    # Service requests for files (URIs) from the maintenance page
    # Note that we always service these pages, even if the http_pool is up
    #
    set uri [HTTP::uri]
    if { $uri equals "/sorrypage" } {
       HTTP::respond 301 "Location" "/sorrypage/"
       return
    }
    if { $uri starts_with "/sorrypage/" } {
       # trim off the maintenance prefix
       set uri [string range $uri 10 end]

       # Return the requested page
       switch $uri {
         "/"              -
         "/index.html"   { HTTP::respond 200 content [class element -value 0 sorrypage_ores_sorrypage_htm] "Content-Type" "text/html" }
         "/logo_ORES.jpg"   { HTTP::respond 200 content [b64decode [class element -value 0 sorrypage_logo_ORES_jpg]] "Content-Type" "image/jpeg" }
         default         { HTTP::respond 404 }
       }
       return
    }

    #
    # If the http_pool is down, redirect to the maintenance page
    #
    if {[active_members [LB::server pool]] ==0}{
      HTTP::redirect "/sorrypage/index.html"
      return
    }
}

Lorsque le module ASM est activé et qu’il n’y a pas de default pool sélectionné

when HTTP_CLASS_SELECTED {
    #
    # Service requests for files (URIs) from the maintenance page
    # Note that we always service these pages, even if the http_pool is up
    #
    set uri [HTTP::uri]
    if { $uri equals "/sorrypage" } {
       HTTP::respond 301 "Location" "/sorrypage/"
       return
    }
    if { $uri starts_with "/sorrypage/" } {
       # trim off the maintenance prefix
       set uri [string range $uri 10 end]

       # Return the requested page
       switch $uri {
         "/"              -
         "/index.html"   { HTTP::respond 200 content [class element -value 0 sorrypage_ores_sorrypage_htm] "Content-Type" "text/html" }
         "/logo_ORES.jpg"   { HTTP::respond 200 content [b64decode [class element -value 0 sorrypage_logo_ORES_jpg]] "Content-Type" "image/jpeg" }
         default         { HTTP::respond 404 }
       }
       return
    }

    #
    # If the http_pool is down, redirect to the maintenance page
    if {[active_members [LB::server pool]] ==0}{
      HTTP::redirect "/sorrypage/index.html"
      return
    }
}

|

simon.melotte

0 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *