Netscaler - Involving Response Body Replacement with GeoIP Implementation

Posted by MrGoodbyte on Server Fault See other posts from Server Fault or by MrGoodbyte
Published on 2012-10-02T09:25:39Z Indexed on 2012/10/02 9:39 UTC
Read the original article Hit count: 588

Filed under:
|
|

I have a Netscaler (10000) NS9.3: Build 52.3.cl

There is a document contains a short tutorial about GeoIP database implementation at http://support.citrix.com/article/CTX130701

I have added location database by following this tutorial successfully but instead of dropping connections I need to replace a string in content body. To do that, I created a rewrite action with those parameters.

* Name: ns_country_replacement_action
* Type: REPLACE_ALL
* Target Expression: HTTP.RES.BODY(50000)
* Replacement Text: HTTP.RES.HEADER("international")
* Pattern: \{\/\*COUNTRY_NAME\*\/\}

To insert header called "international", I try to create another rewrite action with those parameters. I'll add this one's policy prior.

* Name: ns_country_injection_action
* Type: INSERT_HTTP_HEADER
* Header Name: international
* Header Value: CLIENT.IP.SRC.MATCHES_LOCATION("*.US.*.*.*.*").NOT

When I click on create button, it says;

Compound expression syntax error, [.*.*").NOT^, 50]

I'm not sure but I think that two things might cause this error.

  • The expression I use for MATCHES_LOCATION is wrong but I use same expression in the tutorial.
  • MATCHES_LOCATION().NOT returns BOOLEAN but the field expects STRING.

How can I get this work? Do I use right tools to accomplish what I need to do?

Thank you.

-Umut

© Server Fault or respective owner

Related posts about load-balancing

Related posts about geoip