Forum Discussion

Scott_S_160682's avatar
Scott_S_160682
Icon for Nimbostratus rankNimbostratus
Nov 25, 2014

How do I route traffic to a specific directory on a node?

I have a couple of nodes that serve webpages on:

 

 

 

I can connect directly to the server using, and the page displays fine. However, if I use http://server1:9080, I get an error - the virtual directory hasn't been created.

 

I tried using an irule to rewrite the url sent to the node:

 

when HTTP_REQUEST_RELEASE { HTTP::header replace Host "[LB::server addr]:9080/website" }

 

The irule partially worked and sent traffic to http://server1%12:9080 (the F5 has 2 route domains) but didn't add /website after the port number.

 

Is there another way to get to a specific directory on a node?

 

3 Replies

  • The path(directory) is not in the Host header, only the hostname and optional port are. You need to modify the HTTP::uri instead. The forums are full of examples on rewriting the URI.

     

  • mimlo, thanks for your response, i'm able to rewrite the uri using

     

    when HTTP_REQUEST_RELEASE { HTTP::header replace Host "[LB::server addr]" HTTP::path "/website" }

     

    but since we use route domains the uri is http://server1%12:9080/website

     

    how do i get rid of the %12 route domain

     

  • how do i get rid of the %12 route domain

    you can use scan command.

    e.g.

    % set ip 1.2.3.4%12
    1.2.3.4%12
    
    % scan $ip {%[^%]} iponly
    1
    
    % put $iponly
    1.2.3.4