Forum Discussion

ITOPSNetwTeam_6's avatar
ITOPSNetwTeam_6
Icon for Nimbostratus rankNimbostratus
Jul 28, 2017

Error page if a FQDN node is unavailable

Hi,

Using an LTM running V11.5.4, I load balance a web application to a FQDN node with an iRule :

when HTTP_REQUEST {
  set dest [RESOLV::lookup @8.8.8.8 -a FQDN-of-the-node]
  log local0.info "destination address : $dest"
  if { $dest ne "" } {
    node $dest
    log local0.info "node used : $dest"
  } else {
    HTTP::respond 302 Location "location-of-an-error-page"
  }
}

This iRule redirects to an error page only if the RESOLV fails, but if the application on the node is unavailable then the client request must also be redirected to this error page. How can this be configured? For nodes having a fixed IP address this can be achieved by assigning a Monitor to the node, but the node $dest has a dynamic IP address...

Regards,

Ivo

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    I guess you must already know that an upgrade to v11.6.1 would be the best way out of this problem, but you can't upgrade for some reason.

     

    You could alternatively define a fallback host in your http profile to serve this error page.

     

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    Then try the following:

    when HTTP_REQUEST {
        set dest [RESOLV::lookup @8.8.8.8 -a FQDN-of-the-node]
        log local0.info "destination address : $dest"
        if { $dest ne "" } {
            node $dest
            log local0.info "node used : $dest"
        } else {
            HTTP::fallback "http://host.domain.com/redirect.html"
        }
    }
    

    .