# Allow a connection based on source IP to a URI

**URL:** <https://community.a10networks.com/t/allow-a-connection-based-on-source-ip-to-a-uri/149>\
**Category:** aFleX\
**Created:** [March 21, 2012, 4:15pm UTC](https://community.a10networks.com/t/allow-a-connection-based-on-source-ip-to-a-uri/149 "2012-03-21T16:15:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgreen](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jgreen](https://community.a10networks.com/u/jgreen)\
**Post date:** [March 21, 2012, 4:15pm UTC](https://community.a10networks.com/t/allow-a-connection-based-on-source-ip-to-a-uri/149/1 "2012-03-21T16:15:30Z")

</div>

How would I allow a connection based on source IP (or serveral source IPs) to an URI? I know in the f5 I can just create data groups and do a class match, but I am not sure how to do it on the a10.

---

<div class="post-metadata">

**Author:** ![jgreen](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jgreen](https://community.a10networks.com/u/jgreen)\
**Post date:** [March 21, 2012, 4:22pm UTC](https://community.a10networks.com/t/allow-a-connection-based-on-source-ip-to-a-uri/149/2 "2012-03-21T16:22:40Z")

</div>

I found it.

when HTTP\_REQUEST

{if {not [IP::addr [IP::client\_addr] equals 192.168.18.0/24] and ([HTTP::uri] starts\_with

“/private”)}

{HTTP::respond 200 content “

Transitional//EN”\>

My company

content=”text/html; charset=iso-8859-1″\>

This web section is accessible only from our corporate offices. “

}

}

---

<div class="post-metadata">

**Author:** ![jgreen](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@jgreen](https://community.a10networks.com/u/jgreen)\
**Post date:** [March 21, 2012, 4:31pm UTC](https://community.a10networks.com/t/allow-a-connection-based-on-source-ip-to-a-uri/149/3 "2012-03-21T16:31:28Z")

</div>

I get this error when I use the format in the example aflex section.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/a10_community/original/1X/bb9f186d33804d3044a0374e589f49fdf3be1328.png) [@system](https://community.a10networks.com/u/system)\
**Post date:** [March 21, 2012, 5:35pm UTC](https://community.a10networks.com/t/allow-a-connection-based-on-source-ip-to-a-uri/149/4 "2012-03-21T17:35:08Z")

</div>

It’s your double quotes. They are showing up in a strange font when you copy it from the forum. re-type them in notepad, or in the GUI aflex screen.  
`when HTTP_REQUEST {`  
`if { not[IP::addr [IP::client_addr] equals 192.168.18.0/24] and ([HTTP::uri] starts_with "/private" )} {`  
`HTTP::respond 200 content "Transitional//EN>`  
`My company content=text/html; charset=iso-8859-1?>`  
`This web section is accessible only from our corporate offices."`  
`}`  
`}`
