Forum Discussion

Dormelchen_1077's avatar
Dormelchen_1077
Icon for Nimbostratus rankNimbostratus
Apr 30, 2010

is it possible to get a valid response ?

hello,

 

 

i have a problem.

 

Part of the rule:

 

 

when CLIENT_ACCEPTED

 

{ persist none }

 

when HTTP_REQUEST {

 

set lowerURI [string tolower [HTTP::uri]]

 

log local0. "$lowerURI"

 

switch [HTTP::host] {

 

www.test.de

 

{ if { $lowerURI starts_with "/test.aspx" } { HTTP::redirect "http://111.111.111.111[HTTP::uri]" }

 

elseif { $lowerURI starts_with "/b2b" } { persist source_addr pool }

 

else { if { $lowerURI eq "/" or $lowerURI eq "" or $lowerURI starts_with "/welcome.de.aspx" }

 

{ HTTP::redirect "http://www.test.de/default.aspx?/de-de"}

 

else { persist source_addr pool }

 

return

 

 

My problem is the "b2b" part.

 

 

In my browser i paste the url www.test.de/b2b/ and it shows me : Error page not found.

 

Cause - the website is in the root directory.

 

if i try to call the IP adress of the webserver its all ok.

 

 

I cannot use the www.test.de cause this www.test.de points to another webpage on this server.

 

i have to use www.test.de/b2b ...

 

 

i think that the Loadbalancer tries to retrieve the /b2b/ - but he has to retrieve the root directory.

 

 

Is it possible to configure it on the BIG-IP F5 with irule or other ?

 

3 Replies

  • For any request which starts with /b2b, you're selecting the www.test.de_B2B_80 pool. But you're not changing the URI. Do you want to remove the /b2b string from the URI? If so you can use string range to do this: HTTP::path [string range [HTTP::path] 3 end].

    when CLIENT_ACCEPTED {
       persist none
    }
    when HTTP_REQUEST {
       switch [HTTP::host] {
          www.test.de {
             switch -glob [string tolower [HTTP::path]] {
                "/test.aspx" {
                   HTTP::redirect "http://111.111.111.111[HTTP::uri]"
                }
                "/b2b*" {
                   persist source_addr
                   pool www.test.de_B2B_80
    
                    Remove /b2b from the path
                   HTTP::path [string range [HTTP::path] 3 end]
                }
                "/" -
                "/welcome.de.aspx" {
                   HTTP::redirect "http://www.test.de/default.aspx?/de-de"
                }
                default {
                   persist source_addr
                   pool www.test.de_80
                }
             }
          }
       }
    }
    

    Aaron
  • I couldn't get either of these to work when I tested them. I've had great success adding to the URI, and would like to know how to specifically remove from it (without Chunking).:

    
    when HTTP_REQUEST {
    if { [HTTP::uri] starts_with "/b2b" } {
    HTTP::path [string range [HTTP::path] 3 end]
    }
    }
    

    or

    
    when HTTP_REQUEST {
    if { [HTTP::uri] starts_with "/b2b" } {
    HTTP::path [string trimleft [HTTP::path] /b2b]
    }
    }
    

    Any insight?
  • OK. I got it this one working on the HTTP_REQUEST with this:

    
    when HTTP_REQUEST {
    if { [HTTP::uri] starts_with "/b2b" } {
    HTTP::uri [string map {"/b2b" ""} [HTTP::uri]]
    }
    }