iRule to redirect with an elseif statement
hi Dev's Want an iRule to detect the URL – http://xxsupplier.xx.com/supplierguide and re-direct it to https://xxsupplier.xx.com/supplier_guide.html But, if the user enters just http://xxsupplier.xx.com we want them to be redirected to the HTTPS VIP of the same name
I have the following iRule, however it does not seem to execute the 2nd part. It WILL detect http://xxsupplier.xx.com/supplierguide and redirect to https://xxsupplier.xx.com/supplier_guide.html However if the user simply enters http://xxsupplier.xx.com the request in the browser will say ‘cannot connect”
Thus, my conclusion is that the ‘elseif’ part of my iRule isn’t working.
Any help greatly appreciated.
There are VIPS defined on both 443 and 80 with the same IP address.
when HTTP_REQUEST { set host [HTTP::host] if { [HTTP::host] equals "xxsupplier.xx.com" and [HTTP::uri] starts_with "/supplierguide" } { HTTP::redirect "; } elseif { [HTTP::host] } { HTTP::respond 302 Location "https://$host/" } }