Access control policy not working

I am trying to implement an IP range based allow/deny using Access control policy. Providing screenshot of the proxy debug screen showing my ip as the first one in X-FORWARDED_FOR. The same address is present in proxy.client.ip field also.

abhijithsh_0-1678440835567.png

However, the policy is not denying access. Below is the implementation I have used.

abhijithsh_1-1678440907435.png

Let me know if anyone can help @dchiesa1 @API-Evangelist 

Thanks in advance

 

1 2 319
2 REPLIES 2

If you just experimenting its ok else start exploring kvm -https://cloud.google.com/apigee/docs/api-platform/reference/policies/access-control-policy#deny-usin...

May be use ValidateBasedOn if it helps as I see multiple ip's

==

When the X-Forwarded-For HTTP header contains multiple IP addresses, use this ValidateBasedOn element to control which IP addresses are evaluated.

==

 Documentations in apigee are well written (Mostly) just need to go thru each attribute which will help. Good luck.

 

 

<AccessControl name="ACL">
 
<IPRules noRuleMatchAction = "ALLOW">
   
<MatchRule action = "DENY">
     
<SourceAddress mask="32">198.51.100.1</SourceAddress>
   
</MatchRule>
 
</IPRules>
</AccessControl>
<AccessControl name="ACL">
 
<IPRules noRuleMatchAction = "ALLOW">
   
<MatchRule action = "DENY">
     
<SourceAddress mask="32">198.51.100.1</SourceAddress>
   
</MatchRule>
 
</IPRules>
</AccessControl>
<AccessControl name="ACL">
 
<IPRules noRuleMatchAction = "ALLOW">
   
<MatchRule action = "DENY">
     
<SourceAddress mask="32">198.51.100.1</SourceAddress>
   
</MatchRule>
 
</IPRules>
</AccessControl>

 

It could be it's validating based on the last ip of the X-Forwarded-For, please refer to https://docs.apigee.com/api-platform/reference/policies/access-control-policy#xforwardedfor