Forum Discussion

Joe_Curl_105786's avatar
Joe_Curl_105786
Icon for Nimbostratus rankNimbostratus
Aug 31, 2009

Multiple Web Pages on single server

I have a case where I have two web pages that are hosted on the same web server. The first application is /index.jsp, and the second is /pkl/index.jsp. I am trying to figure out how to get the traffic to the right directory based on the url.

 

 

Site 1 site1.portal.hca.com to /index.jsp

 

Site 2 iphone.portal.hca.com to /pkl/index.jsp

 

 

Any help is appreciated.

 

 

Joe

5 Replies

  • Joe: would it be enough to just switch on the HTTP::host portion of the request? If so, something like this may work for you:

     
     when HTTP_REQUEST { 
      
     switch [string tolower [HTTP::host]] { 
     site1.portal.hca.com { pool site1-pool } 
     iphone.portal.hca.com { pool iphone-pool } 
     default { pool default-pool } 
     } 
     } 
     

    If you need to manually add the "/pkl/" portion to the URI you can do that, but I'd bet that the application server will do that for you via a redirect. If you need help with the URIs please post back and we'll have a look at that option as well.

    -Matt

  • Hi Joe,

     

    If you have a single web server either apache or IIS you should be able to direct the traffic based on host header rather then using an irule to accomplish this.

     

     

    I hope this help

     

    CB

     

  • We looked at doing this on the server side and because of the way the application is done, it does not seem to be an option. One other idea that came up was to somehow identify if the request is coming from an iPhone then send it to the page that is hosted in the /pkl/ directory. This would make it easier in that we just have one URL and we just send them to the right page based on what type of device it is.

     

     

    Joe
  • Here is something I put together. Let me know if anyone has any better ideas or suggestions.

     

     

    when HTTP_REQUEST {

     

    Check if User-Agent header is an iPhone

     

    if { [string tolower [HTTP::header User-Agent]] contains "iphone" } {

     

    HTTP::redirect "http://site2.portal.hca.com/pkl/"

     

    }

     

    }

     

  • Joe: I think that last rule may cause a redirect loop - every time the user-agent is iphone you'll redirect...you may want to add some extra logic to account for that.

     

    -Matt