Forum Discussion

kenny_50210's avatar
kenny_50210
Icon for Nimbostratus rankNimbostratus
Jul 22, 2013

IIS Virtual Directories help needed. Thanks!

Hello,

 

We have roughly ~10 virutal directories in IIS with the iRule below and having some issues.

 

Config:

 

2 servers (Nodes)

 

10 pools for each virtual directory (LB - Round Robin) (Config - basic)

 

VS - All defaults - Protocol Profile Client (tcp-wan-optimized); Oneconnect (oneconnect); http profile (default http ); HTTP compression (wan-optimized-compression); web acceleration (optimized-caching) -- no default pools selected -- no Persist (per our web dev team as they are handling it on the backend.)

 

iRule: this is only a portion of the iRule as the rest the the same.

 

when HTTP_REQUEST {

 

if {([string tolower [HTTP::uri]] starts_with "cassadmintest") and ([HTTP::uri] equals "/")} {

 

HTTP::redirect "http://cassadmintest/cassadmin"

 

pool CassAdmin_test

 

} elseif {([string tolower [HTTP::uri]] starts_with "enoticesadmintest") and ([HTTP::uri] equals "/")} {

 

HTTP::redirect "http://enoticesadmintest/enoticesadmin"

 

pool Enoticesadmin_test

 

} elseif {([string tolower [HTTP::host]] starts_with "pcmtest") and ([HTTP::uri] equals "/")} {

 

HTTP::redirect "http://PCMTest/PCMTest"

 

pool PipelineCustMgmt_test

 

}

 

}

 

----------------------------

 

What we are trying to accomplish is when a user types cassadmintest in the address bar it redirects them to http://cassadmintest/cassadmin and so on and so forth with all of the other directories. The redirection work flawlessly however we are having other issues that comes with this.

 

Our issues:

 

1. When I visit the site not all of the images show up. I use fiddler to see what's going on and there's tons of 504's. If i keep refreshing sometimes the images will show up and other time it won't. This is why I turned on oneconnect, http commpresion... etc.. on the VS. With all of these on or off I am still having issues. I even messed with chunking and still no luck.

 

2. when browsing the page everything works fine (except for the image issues) but when step away for a few mintues and refresh the page I get a 404. For troubleshooting, I turned on persist (source IP) still the same.

 

This all works fine on the Netscaler and I am in the process migrating everything to the F5 and this has been a road block for me. Thanks in advance!

 

 

 

 

 

3 Replies

  • should I take a different approach on the configuration? or am i missing something?

     

     

    Thanks!

     

  • Hi Kenny,

    You could save yourself a redirect by just modifying the incoming URI that is sent to the server instead of doing a full 302 Redirect.

    Replace: HTTP::redirect "http://cassadmintest/cassadmin"

    With: HTTP::uri "/cassadmin" and then send it to the pool. This will append the value to the end of the request and send it to the pool (that you have listed in the next line).

    You can read up more on that here: HTTP::uri. Note: This is different from the normal [HTTP::uri] command.

    Since you stated that this is just a portion of the iRule I don't know if you are doing it later down the line, but you should have a default action that handles the traffic if it is formatted properly.

    Example:

    - Request http://cassadmintest/ is directed to http://cassadmintest/cassadmin

    - Now what happens when you are coming in to http://cassadmintest/cassadmin ???

    Unless you have something that is a default of "send all traffic not handled by this iRule to the correct pool of servers...so that the server can sort out where it should go" then you will need to compensate by adding it.

    Something like this:

     
    when HTTP_REQUEST {
    switch -glob [string tolower [HTTP::host]] {
    "cassadmintest*" {
    if ([string tolower [HTTP::uri] equals "/") {
    HTTP::uri "/cassadmin"
    pool CassAdmin_test
    return
    }
    else {
    pool CassAdmin_test
    }
    

    Doing this should resolve your missing images problem.

    Depending on how many of these you are doing I would suggest looking into a switch statement.

    Regarding your statement:

    no default pools selected -- no Persist (per our web dev team as they are handling it on the backend.)

    We use the same term to describe different things. The F5's do not actually handle "Session Persistence" which is probably what your Developers are thinking. The F5 LTM handles "Server Affinity", meaning that we make sure that all of your client traffic goes to the same server. I'm sure that if you clarify that with your Developers they will want what we call Persistence added to the Virtual Server. (Cookie being the default, but that will only work properly with Web Browsers...if the Virtual Handles Application to Application Traffic....Cookie Persistence is not for you and I would suggest source_addr or something else).

    Hope this helps. If any of this is confusion or unclear just let us know.

  • Thanks Michael! I reading about the switch command now and then i'll finish the iRule that you were so kind to helped me with.

     

    Thanks again,

     

    Kenny