Forum Discussion

9 Replies

  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account

     

    This iRule (Click here)

     

    could be modified to redirect to http instead of https, and applied to the https virtual.

     

     

    /deb

     

  • I have the same issue and I tried that one but the server stays in one infinite loop.

     

     

    Looks like keeps redirecting the redirection.

     

     

    Is there any way to stop this infinite loop?

     

     

  • Gerardo.

     

     

    I actually modified the iRule as follows:

     

     

    when HTTP_REQUEST {

     

    HTTP::redirect http://[HTTP::host][HTTP::uri]

     

    }

     

     

    I applied this iRule to the HTTPS virtual server.

     

     

    The HTTP virtual servers points to a pool, and when I type "https://domainname.com" it redirects to "http://domainname.com" without any problems.

     

     

    I had to enable "http" profile and a "SSL Profile (Client)" on the HTTPS virtual server as well

     

     

     

    I hope this helps

     

     

     

    Andres
  • My problem is that I need to convert all the traffic to https

     

     

    All the traffic comming from http need to return to the client as https

     

     

  • OK.

     

     

    I was doing the opposite. (https to http)

     

     

    Use the following iRule instead:

     

     

    when HTTP_REQUEST {

     

    HTTP::redirect https://[HTTP::host][HTTP::uri]

     

    }

     

     

     

    apply it to the HTTP virtual server.

     

     

     

    Regards.

     

     

    Andres
  • Thats the rule that causes the infinite loop

     

    my issue is that I have mixed content with http and https

     

     

  • Just to confirm.

     

     

    The HTTP virtual server has the iRule:

     

     

    when HTTP_REQUEST {

     

    HTTP::redirect http://[HTTP::host] [HTTP::uri]

     

    }

     

     

     

    what do you have on the HTTPS virtual server ?

     

     

    another irule, or a pool?

     

     

     

    Andres
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    I recently updated the description of this iRule in the codeshare to address this point of confusion -- if the virtual to which it is applied is processing HTTPS traffic on port 443, it will result in an infinite redirect loop:

    Link above now gives the following guidance:

    Do not apply this iRule to shared/wildcard virtual server responding to HTTPS traffic, or infinite redirect will occur. Create separate virtual servers on port 80 and port 443, and apply this iRule ONLY to the port 80 HTTP-only virtual server. No iRule is needed on the port 443 HTTPS virtual server.

    The above rule may be modified to function on a shared virtual server by testing [TCP::local_port] and redirecting only if the request came in over port 80:
    when HTTP_REQUEST {
      if { [TCP::local_port] == 80 }{
        HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
      }
    }
    (Adding this enhancement to the same codeshare page linked above.)

    /deb