Forum Discussion

FLHouse_151647's avatar
FLHouse_151647
Icon for Nimbostratus rankNimbostratus
Jan 25, 2017

iRule for specific URL from HTTPS to HTTP

iRule to redirect HTTPS back to HTTP only for specific URL with wildcard after ? "/VideoPlayer.aspx?eventID=2443575804_2017011157&committeeID=2911"

 

I have a iRule to redirect HTTP to HTTPS when visiting a site that starts with "/LD" but I need an iRule to redirect only "VideoPlayer.aspx?*" back to HTTP. This is what I started with, but it breaks my HTTPS requirement to redirect my /LD directory.

 

Any assistance would be greatly appreciated!

 

HTTPS assigned when HTTP_REQUEST { if { [HTTP::uri] contains "VideoPlayer" && [HTTP::uri] contains ".aspx?" } HTTP::redirect "http://[HTTP::host]$uri" }

 

HTTP assigned when HTTP_REQUEST { if { ( [string tolower [HTTP::uri]] starts_with "/ld" ) } { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }

 

1 Reply

  • How about something like what's below to start from for the HTTPS virtual server. You can use HTTP::path to extract just the path portion of the URI (without the query string).

    when HTTP_REQUEST {
        if { [string tolower[HTTP::path]] ends_with "videoplayer.aspx" } {
            HTTP::redirect "http://[HTTP::host][HTTP::uri]"
        }
    }