For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

tran_93981's avatar
tran_93981
Icon for Nimbostratus rankNimbostratus
Oct 11, 2015

proxy to specific node with specific url

Hello,

 

I am trying to write iRule to accomplish this

 

Here is what I am trying to do

 

http://publicserver.com/engineering/las ---> internalserver.com:9290/las http://publicserver.com/engineering/thredds --> internalserver.pmel.noaa.gov:9290/thredds Any other requests goes to the default pool (default pool uses port 80).

 

My iRule is like this

 

when HTTP_REQUEST { if {([HTTP::uri] starts_with "/engineering/las")} { HTTP::uri "/las" node a.b.c.d:9290 log local0. "/ENGINEERING/LAS::::::[HTTP::host] THE-IFuri[HTTP::uri]" } elseif {([HTTP::uri] starts_with "/engineering/thredds")} { HTTP::uri "/thredds" node a.b.c.d:9290 log local0. "/ENGINEERING/THREDDS::::[HTTP::host] THE-uri2[HTTP::uri]" } else { pool public-pool } }

 

However my iRule does not work as I want it to do. Instead it is doing like this:

 

When a user is trying to go to http://publicserver.com/engineering/las or http://publicserver.com/engineering/thredds, the ltm is not sending (proxy) those request to internalserver.com:9290/las or internalserver.com:9290/thredds respectively, the ltm is sending the requests to publicserver.com/las or publicserver.com/thredds

 

Thanks for any help

 

17 Replies

  • You could try setting the pool for new-internalserver.com as the default pool on the VS, and then update the URI in the iRule, and then change the pool for any others that don't match to the old server pool

     

  • Thank you Michael. I will definitely try your suggestion. I need to schedule the maintenance time for this. I will update you how does it go.

     

  • Hello,

    Sorry it took long to post this. I had not have a chance to try it until yesterday. I tried your suggestion but unfortunately, it does not solve problem. So the irule is written like this

     when HTTP_REQUEST {
        log local0. "[HTTP::uri] ****" 
     if {([HTTP::uri] starts_with "/engineering/las")} {
         log local0. "redirecting to /las"
           HTTP::uri "/las/"
       } elseif {([HTTP::uri] starts_with "/engineering/thredds")} {
           log local0. "redirecting to /thredds"
           HTTP::uri "/thredds/"
       } else {
            log local0. "using pool yaquina-only"
           pool yaquina-only
       }
    }
    
    What I am experiencing with this re-written irule is: the "else" statement works but the "if" and "elseif" do not work.  When a user tries to get to http://publicserver.com/engineering/las, the page displays saying "not found".  I believe it is because the "if" changes the uri and the requests becomes http://publicserver.com/las then that request matches the "else" statement.