Need help with IRULE for http ssl redirect

I created IRUle to redirect our Intranet site from http to https. However the application is sending redirect back to client with full URI. I configured it to redirect to our home page.

Is there a way to have the IRULE redirect keeping full path

Example of the IRULE

when HTTP_REQUEST { if { [string tolower [HTTP::host]] ends_with “intranet.pen.org” } { HTTP::redirect “https://intranet.pen.org” } }

Would like to have the IRULE redirect back with

intranet.pen.org/path that the client issued the get for which would be * anything

Please help

Try this:

when HTTP_REQUEST { 
    if { [string tolower [HTTP::host]] ends_with "intranet.pen.org" } {     
        HTTP::redirect "https://intranet.pen.org[HTTP::uri]" 
    } 
}

If no path is specified, [HTTP::uri] will equal “/”, so it should always work.