Forum Discussion

Tony_Marques_92's avatar
Tony_Marques_92
Icon for Nimbostratus rankNimbostratus
Mar 12, 2013

Append to URL of a Virtual Server

I've created a Virtual Server and when I test it out by going to https://test.com" it pulls up the default web page of the server (e.g. https://test.com/default/app). I am new to iRULES and Tcl therefore this will probably sound like a question with a simple solution. I would like to have it when someone types in https://test.com it will direct them to https://test.com/prefer/app instead of the deault page of the server listed above. I;ve found several discusssion threads on this, but nothing I've tried worked yet. Any assistance on this would be greatly appreciated. In the meantime, I'll continue to plug away at this on my own.

 

 

Regards,

 

Tony

 

8 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Tony,

    How about this:

    when HTTP_REQUEST {
    if { [HTTP::path] equals "/" } {
    HTTP::redirect "https://[HTTP::host]/prefer/app"
    }
    } 

    Rgds

    N
  • Hi Nathan,

     

     

    That did not work. Are there logs on the LTM that we can look at to see if it is even attempting to use the iRule? How does it know when to use that specific iRule for that specific VS and not for any other VS?

     

     

    Regards,

     

    Tony
  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Tony,

     

     

    A few things you'll need to do. Firstly, you'll need to terminate the SSL connection on the VS so the f5 can see the connection in the clear (with an SSL Client Profile). Are you terminating the SSL connection? You'll also need an HTTP profile on the VS and then you'll need to add the iRule to the VS under the Resources tab.

     

     

    Hope this helps,

     

    N
  • Hi Nathan,

     

     

    My Virtual Server is set-up to use Service Port 443, does have a HTTP Profile assigned to it, dose have an SSL Profile (Client) assigned to it (but none for Server). I did add the iRule in the Resources tab. It is still appending the default location instead of the preferred one.

     

     

    Regards,

     

    Tony Marques
  • ....I just checked the iRules statistics and do now see 82 Total Executions. So it it hitting the rule, but the rule doesn't appear to do what I would like it to do.

     

     

    Regards,

     

    Tony
  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Tony

    Try this:

    when HTTP_REQUEST {
        if { [HTTP::path] equals "/" } {
            HTTP::redirect "/prefer/app/"
        }
    } 

    PS - what about if you check the connection in fiddler/httpfox, can you see the redirect here?

    N
  • Hi Nathan,

     

     

    Looks like I had to clear my SSL cache on IE and it worked. Thanks for all your help!!!

     

     

    Regards,

     

    Tony
  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus
    Good news. Thanks for letting us know. Glad I could help.