Forum Discussion

Thiyagu_343098's avatar
Thiyagu_343098
Icon for Nimbostratus rankNimbostratus
Apr 10, 2018

Redirection based on URI on the request and inserting the URI path to the server

Hello Team, I'm working on request from the application team to categorize URI from the request and based on the URI the new URI path needs to be inserted on LB and it should routed to the server.

 

For example if the request from the client is as below: http://www.test.com/URI1/ and on LB when it routed the backend server it should be as http:/SERVER1/URI1/URI2/URI3.html

 

http://www.test.com/URI2/ and on LB when it routed the backend server it should be as http:/SERVER1/URI4/URI5/URI6.html

 

Could you please help me how I can achive this on LB?

 

Thanks a lot in advance for your help.

 

Regards, Thiyagu

 

2 Replies

  • You can use the string map to achieve this,

    when HTTP_REQUEST {
    if { [string tolower [HTTP::uri]] starts_with "/URI1" } {
    HTTP::uri [string map {"/URI1" "/URI1/URI2/URI3.html"} [HTTP::uri]]
    }
    if { [string tolower [HTTP::uri]] starts_with "/URI2" } {
    HTTP::uri [string map {"/URI2" "/URI4/URI5/URI6.html"} [HTTP::uri]]
    }
    }