# URL access restriction

**URL:** <https://community.a10networks.com/t/url-access-restriction/494>\
**Category:** System\
**Tags:** aflex\
**Created:** [March 9, 2018, 11:58am UTC](https://community.a10networks.com/t/url-access-restriction/494 "2018-03-09T11:58:49Z")\
**Posts on this page:** 2\
**Page:** 1

<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 9, 2018, 11:58am UTC](https://community.a10networks.com/t/url-access-restriction/494/1 "2018-03-09T11:58:49Z")

</div>

Hi all,  
I’m working on a vThunder 2.7.2-P10 that is publicing many URL form a single virtual IP. Now I need to deny access from some IPs only for some URLs (not for all). For example I have 3 sites:

```auto
site1.example.com
site2.example.com
site3.example.com

```

And some IPs let’s say:

```auto
1.2.3.4
1.2.3.5
1.2.3.6

```

I need those IPs can access only on site 1 but not site2 and 3. All other IPs can access every sites. Is there a way to accomplish this?

Thanks

Luca

---

<div class="post-metadata">

**Author:** ![hkohn72](https://avatars.discourse-cdn.com/v4/letter/h/f9ae1b/32.png) [@hkohn72](https://community.a10networks.com/u/hkohn72)\
**Post date:** [March 15, 2018, 10:59am UTC](https://community.a10networks.com/t/url-access-restriction/494/2 "2018-03-15T10:59:56Z")

</div>

Hello Luca,

you solve this complexity with aFlex.  
In the example below you find your solution in a simple version. I can be extended with class list and you can change the action from TCP::close to HTTP::redirect “[http://site1.example.com/](http://site1.example.com/)”

```auto
aFlex: IP-Host-restriction
when HTTP\_REQUEST \{
  if \{ [IP::addr [IP::client\_addr] equals 1.2.3.0/29] \} \{
    if \{ [HTTP::host] equals "site1.example.com" \} \{
    \} else \{

```

TCP::close

```auto
    \}
  \}
\}

```

Please let me know if you need so more details.

CU hkohn!
