Forum Discussion

Benjamin_Moore_'s avatar
Benjamin_Moore_
Icon for Nimbostratus rankNimbostratus
Aug 20, 2014
Solved

How do I redirect to a URL

I want all traffic destined to a VIP over HTTPS to be redirected to https://servername/cgi-bin/wf.html. How do I accomplish this withing LTM?

 

  • It looks like this creates a redirect loop since the redirected request has the same hostname as your if statement. Try:

    when HTTP_REQUEST {
     if {[string tolower [HTTP::host]] equals "webdrop.xxx.com" and not ([string tolower [HTTP::uri]] equals "/cgi-bin/wf.html")} {
                HTTP::redirect "https://webdrop.xxx.com/cgi-bin/wf.html"
     }
    }
    

11 Replies

  • I'm doing SSL offloading to get visibility in to the URL and I've applied the following iRule to the Virtual Server: when HTTP_REQUEST { if {[string tolower [HTTP::host]] equals "webdrop.xxx.com"} { HTTP::redirect "https://webdrop.xxx.com/cgi-bin/wf.html" } }
  • shaggy's avatar
    shaggy
    Icon for Nimbostratus rankNimbostratus

    It looks like this creates a redirect loop since the redirected request has the same hostname as your if statement. Try:

    when HTTP_REQUEST {
     if {[string tolower [HTTP::host]] equals "webdrop.xxx.com" and not ([string tolower [HTTP::uri]] equals "/cgi-bin/wf.html")} {
                HTTP::redirect "https://webdrop.xxx.com/cgi-bin/wf.html"
     }
    }
    
    • Benjamin_Moore_'s avatar
      Benjamin_Moore_
      Icon for Nimbostratus rankNimbostratus
      It appears to be redirecting but part of the Web file manager (QNAP) adds some URL options, such as - /cgi-bin/wf.html?&count=0.4379764038550741 Any way to allow for this redirection?
    • nitass's avatar
      nitass
      Icon for Employee rankEmployee
      i am confused. what are the request url you want to redirect and the redirect url?
    • shaggy's avatar
      shaggy
      Icon for Nimbostratus rankNimbostratus
      change the second "equals" in the if statement to "starts_with"
  • It looks like this creates a redirect loop since the redirected request has the same hostname as your if statement. Try:

    when HTTP_REQUEST {
     if {[string tolower [HTTP::host]] equals "webdrop.xxx.com" and not ([string tolower [HTTP::uri]] equals "/cgi-bin/wf.html")} {
                HTTP::redirect "https://webdrop.xxx.com/cgi-bin/wf.html"
     }
    }
    
    • Benjamin_Moore_'s avatar
      Benjamin_Moore_
      Icon for Nimbostratus rankNimbostratus
      It appears to be redirecting but part of the Web file manager (QNAP) adds some URL options, such as - /cgi-bin/wf.html?&count=0.4379764038550741 Any way to allow for this redirection?
    • nitass's avatar
      nitass
      Icon for Employee rankEmployee
      i am confused. what are the request url you want to redirect and the redirect url?
    • shaggy_121467's avatar
      shaggy_121467
      Icon for Cumulonimbus rankCumulonimbus
      change the second "equals" in the if statement to "starts_with"