vADC Forum

Reply
Occasional Contributor
Posts: 8
Registered: ‎03-20-2014
Accepted Solution

data set key rewritten by another data set key

Hi all,


in the example below both $URLretrevd and $retrievedHH have the $path ...

Why?

Any workaround?


Thanks!




$rule_state = rule.getstate()

 

if ($rule_state == "REQUEST")

  $Req_client_ip = request.getRemoteIP()

  $ReqOrihh = http.getHostHeader()

  $path = http.getPath();

  $Reqheaders = http.getHeaders();

   foreach( $header in hash.keys( $Reqheaders ) ) {

      if ($header == "X-Forwarded-For") {

         $ReqXForwardedFor = ($Reqheaders[$header]);

         data.set( $XForwardedFor, $ReqXForwardedFor );

          data.set( $ReqHH, $ReqOrihh );

         data.set( $URLREQ, $path);

      }

   }

 

if ($rule_state == "RESPONSE"){

   if( http.getResponseCode() == 301 ) {

      $location = http.getResponseHeader( "Location" );

      $headers = http.getResponseHeader( "OriginalHost" );

      $Resheaders = http.getHeaders();

     $retrievedIP = data.get( $XForwardedFor );

     $URLretrevd = data.get( $URLREQ );

      $retrievedHH = data.get( $Reqhh );

      foreach( $header in hash.keys( $Resheaders ) ) {

         if ($header == "X-Forwarded-For") {

            $ResXForwardedFor = ($Resheaders[$header]);

            if ( $ResXForwardedFor = $retrievedIP ) {

               log.info( "JP - " . " req HH URL : " . $retrievedHH . $URLretrevd );

            }

          

      }

   }

}

Occasional Contributor
Posts: 8
Registered: ‎03-20-2014

Re: data set key rewritten by another data set key

more info on the behaviour

ex (code omitted see above for full):

        data.set( $XForwardedFor, $ReqXForwardedFor );

         data.set( $ReqHH, $ReqOrihh );

         data.set( $URLREQ, $path);

         data.set( $REQqs, $qs);


      $retrievedIP = data.get( $XForwardedFor );

      $URLretrevd = data.get( $URLREQ );

      $retrievedHH = data.get( $Reqhh );

      $retrievedQS = data.get( $REQqs );


log.info( "JP - " . " req HH URL : " . "hh : " . $retrievedHH . "url : " . $URLretrevd . "qs : " . $retrievedQS );



this will only print the query string output on all the variables. ex:


JP -  req HH URL : hh : campaign=FavIE_v1url : campaign=FavIE_v1qs : campaign=FavIE_v1


Occasional Contributor
Posts: 8
Registered: ‎03-20-2014

Re: data set key rewritten by another data set key

fixed by appending the variables on the data.set

         data.set( $REQqs, $ReqOrihh.$path.$qs);

Brocadian
Posts: 227
Registered: ‎11-29-2012

Re: Re: data set key rewritten by another data set key

Glad you managed to find your problem and bonus points for updating your Q with the answer!

As an aside, when you are posting TS, did you know we have TS syntax highlighting available?

I have set up a doc here: (Posting TrafficScript to Splash with Syntax Highlighting) that shows how...

Cheers..

Aidan.

Join the Community

Get quick and easy access to valuable resource designed to help you manage your Brocade Network.