# specific internet source IP & internal IP allow

**URL:** <https://community.f5.com/t/specific-internet-source-ip-internal-ip-allow/73528>\
**Category:** Technical Forums\
**Tags:** security\
**Created:** [November 23, 2023, 6:56am UTC](https://community.f5.com/t/specific-internet-source-ip-internal-ip-allow/73528 "2023-11-23T06:56:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![netw](https://avatars.discourse-cdn.com/v4/letter/n/e9c0ed/32.png) [@netw](https://community.f5.com/u/netw)\
**Post date:** [November 23, 2023, 6:56am UTC](https://community.f5.com/t/specific-internet-source-ip-internal-ip-allow/73528/1 "2023-11-23T06:56:19Z")

</div>

Hello,

1.

we have requirement to allow&nbsp;specific 4 public source IP along with private internal IP’s to access&nbsp; specific URI path.

example: specific URI/path

> **[.xyz Domain Names | Join Generation XYZ](https://gen.xyz/)**
>
> .xyz is for every website, everywhere.® We offer the most flexible and affordable domain names to create choice for the next generation of internet users.

2.

All other URI paths should be accessable by any IP

[https://xyz.com/\*](https://xyz.com/function/party/function-engine/v2/fuction/events-messages/)

Please share irule for ltm policy or solution from ASM.

---

<div class="post-metadata">

**Author:** ![Daniel\_Wolf](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/daniel_wolf/32/1119_2.png) [@Daniel\_Wolf](https://community.f5.com/u/Daniel_Wolf)\
**Post date:** [November 25, 2023, 7:40pm UTC](https://community.f5.com/t/specific-internet-source-ip-internal-ip-allow/73528/2 "2023-11-25T19:40:39Z")

</div>

Hi&nbsp; @netw ,

this iRule should do. With or without ASM.

```tcl
when HTTP_REQUEST priority 500 {
    set content "<html>
                    <head>
                        <title>Go away!</title>
                    </head>
                    <body>
                        <h1>Go away!</h1>
                        <p>This page is for authorized users only.</p>
                    </body>
                </html>"
    if { ([HTTP::host] eq "hostname.xyz.com") and ([HTTP::uri] starts_with "/function/party/function-engine/v2/fuction/events-messages") } {
        switch -glob -- [class match [IP::client_addr] eq dg_allowed_ipaddress] {
            "1" {
                return
            }
            default {
                HTTP::respond 403 -version auto content $content noserver
            }
        }
    } else {
        return
    }
    unset -- content
}

```

You need a datagroup of the type&nbsp; **Address** , in this iRule called&nbsp;_dg\_allowed\_ipaddress_.

KR  
Daniel
