cancel
Showing results for 
Search instead for 
Did you mean: 

data set key rewritten by another data set key

SOLVED
jmatos
Occasional Contributor

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 );

            }

          

      }

   }

}

1 ACCEPTED SOLUTION

Accepted Solutions
jmatos
Occasional Contributor

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);

View solution in original post

3 REPLIES 3
jmatos
Occasional Contributor

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


jmatos
Occasional Contributor

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);

aclarke
Frequent Contributor

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.

--
Aidan Clarke
Pulse Secure vADC Product Manager