Forum Discussion

suershTR_178572's avatar
suershTR_178572
Icon for Nimbostratus rankNimbostratus
Nov 27, 2014

Redirect request to specific node depending on the header value..

I have created the irule as below to redirect the request to specific node depending on the header vaules.. getting some error as below.. so could you please suggest. i am not familier with irule creations. rule irule_oa_uiws { when HTTP_REQUEST { if { [HTTP::header "x-oa-uiws"] equals "Server1" } { node 10.205.79.135 80 } elseif { [HTTP::header "x-oa-uiws"] equals "Server2" } { node 10.205.79.136 80 } else { pool OAPPE-UI-EXT-80 } } }

 

Getting error as below: 01070151:3: Rule [irule_oa_uiws] error: line 2: [missing a script after "if"] [] line 3:[undefined procedure: node 10.205.79.135 80] [{node 10.205.79.135 80}] .....etc...

 

2 Replies

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    An error when?

     

    A quick copy & paste into a Lab/VE works fine syntax wise for me...

     

    Ahh... Are you trying to add this via tmsh? You probably need to quote it if you are...

     

    H

     

  • so can you please alter the irule or provide the new irule which forward the request to nodes on the bases of header values.

    as Hamish mentioned, the irule syntax looks okay.

    root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule irule_oa_uiws
    ltm rule irule_oa_uiws {
        when HTTP_REQUEST {
      if { [HTTP::header "x-oa-uiws"] equals "Server1" } {
        node 10.205.79.135 80
      } elseif { [HTTP::header "x-oa-uiws"] equals "Server2" } {
        node 10.205.79.136 80
      } else {
        pool OAPPE-UI-EXT-80
      }
    }
    }