Adding HTTPS redirtct to existing iRule

Greetings - I am trying to edit an existing iRule so that http requests are redirected to https. The issue is, I have several elseif statements in this iRule that I do not want redirected to https. Below is the existing iRule. Can I redirect http requests for the first if statement only?

when CLIENT_ACCEPTED { SSL::disable if {([TCP::local_port] == 443 )} { SSL::enable pool MWSTEST_MDU_COM_HTTPS_POOL } elseif {([TCP::local_port] == 8090 )} { pool MWSTEST-MDU-COM_8090_POOL } elseif {([TCP::local_port] == 8000 )} { pool MWSTEST-MDU-COM_8000_POOL } elseif {([TCP::local_port] == 8085 )} { pool MWSTEST-MDU-COM_8085_POOL }

else reject }

Try this

You can create a HTTPS VIP(say https_vip) with clientssl profile and assign this(MWSTEST_MDU_COM_HTTPS_POOL) pool to it.

Then your iRule looks like this:

when HTTP_REQUEST {

if {([TCP::local_port] == 443 )} {

virtual https_vip

} elseif

.

.

.

Hope this works!