# APM control URI

**URL:** <https://community.f5.com/t/apm-control-uri/49378>\
**Category:** Technical Forums\
**Tags:** big-ip-access-policy-manager-apm, irules, security\
**Created:** [November 26, 2017, 11:20am UTC](https://community.f5.com/t/apm-control-uri/49378 "2017-11-26T11:20:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahir](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@mahir](https://community.f5.com/u/mahir)\
**Post date:** [November 26, 2017, 11:20am UTC](https://community.f5.com/t/apm-control-uri/49378/1 "2017-11-26T11:20:03Z")

</div>

I would like to create an irules that allows me to control at the first opening of a session that the URI starts with a string / ABCDE / and after it redesigns the flow to the pool.the problem when I run the irules the content of the page does not download completely

when ACCESS\_POLICY\_AGENT\_EVENT {

```tcl
if { [ACCESS::policy agent_id] eq "CONTROL" } {

            set uri1 [ACCESS::session data get session.server.landinguri]

             get hash from URI 
            if { $uri1 starts_with "/HABCD/" } {
                ACCESS::session data set session.custom.control_hash 1
            } else {
                ACCESS::session data set session.custom.control_hash 0
            }
        }

```

}

---

<div class="post-metadata">

**Author:** ![stan\_piron](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@stan\_piron](https://community.f5.com/u/stan_piron)\
**Post date:** [November 26, 2017, 12:00pm UTC](https://community.f5.com/t/apm-control-uri/49378/2 "2017-11-26T12:00:48Z")

</div>

Hi,

there are 2 preferred solution :

- use an irule in **ACCESS\_SESSION\_STARTED** event instead of **ACCESS\_POLICY\_AGENT\_EVENT**.

- configure a variable assign in VPE.

but the code you posted may not cause incomplete page.

you can try this variable assign:

**session.custom.control\_hash**

```tcl
expr {[mcget {session.server.landinguri}] starts_with "/HABCD/"}

```
