main problem in your xslt is how you try to extract the headers (e.g. client-ip, X-Forwarded-For)
try e.g.
<xsl:variable name="client-ip" select="dp:http-request-header('client-ip')"/>
note: the client ip is typically in the X-Client-IP header and can be fetched similar as above or via
<xsl:variable name="client-ip" select="dp:client-ip-addr()"/>
and don't forget the namespace declaration (xmlns:dp="http://www.datapower.com/extensions")
and indeed consider indeed @Joseph Morgan 's advice for matching.
------------------------------
Jeroen Willems
Integration Architect - Managing Partner
Integration Designers
------------------------------
Original Message:
Sent: Tue February 18, 2025 09:16 AM
From: Joseph Morgan
Subject: IP Whitelisting in Datapower using XSLT via Processing Policy
Prashant,
First, I'd highly advise putting those IPs in an external document rather than hard-code each one, unless either you're just using the above as an example or you do, in fact, only have two or three IPs to test.
Have you tried using DataPower's "ip-addr-match()" function? See https://www.ibm.com/docs/en/datapower-gateway/10.5.x?topic=functions-dpip-addr-match. You can either use a single IP or a CIDR range on that.
------------------------------
Joseph Morgan
CEO - Independent
Dallas TX
------------------------------