Forum Discussion

MihirP1129's avatar
MihirP1129
Icon for Nimbostratus rankNimbostratus
Jul 03, 2019

iRule to add www without changing URL

Hello F5 community,   Is there a way to add www in front of the URL while keeping the URL intact? For example:   https://abc.com/testfolder/blahblahblah changed to https://WWW.abc.com/testfolder/...
  • Stanislas_Piro2's avatar
    Jul 05, 2019

    Do you want to change Host header sent from the client in server side connection or do you want to redirect the client to  https://WWW.abc.com/testfolder/blahblahblah

     

    to redirect the client, use following code

     

    when HTTP_REQUEST {
        if {[HTTP::host] eq "abc.com"} {
            HTTP::redirect "https://www.abc.com[HTTP::uri]"
        }
    }