3 part redirect irule query. non www to www to https
Hello All
We recently moved over to F5's from another load balancer product and have been gradually moving our staging and live services over after testing has been completed. However one issue has come up. On our previous load balancer there was a http redirect in place so that when users tried to access our SharePoint site without the www. prefix it would redirect them to a specific url e.g. https://www.sharepointsite.com/sites/homepage.aspx
We have it set in the SharePoint 2013 iApp to redirect http traffic to https but my understanding is to do non www to www. we need a iRule. Is that correct? I realise this may sound a fairly trivial issue but all will become clear shortly.
The reason why this isn't trivial is because I won't be able to test this on our staging area, I can only apply it on live, so I have to ensure I get it right. The reason for this is our staging area is https://staging.sharepointsite.com so the iRule wont be the same as if I was redirecting non www to www.
I've spent some time searching on here and haven't found anyone else in exactly the same situation but did find a rule that I think will work. Please can you advise if what I've written below will work if I introduce it into a SharePoint 2013 iApp's config as a iRule. Or if not can you offer advice on what will work please.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] ends_with "sharepointsite.com" } {
HTTP::redirect "https://www.sharepointsite.com[HTTP::uri]"
}
}
That to me looks like it should work but I wondered if that maybe wouldn't be the case when introduced to a iApp. Or if it may take issue with the face theres no dot/fullstop/period before the initial sharepointsite.com
Thanks in advance
Rhys.