Forum Discussion

PK_294685's avatar
PK_294685
Icon for Nimbostratus rankNimbostratus
Feb 09, 2017

HTTP Uri redirect after APM Policy

Hello All,

 

I've went through few posts on devcentral for executing HTTP_REQUEST after APM Policy, But none worked for me. So here is the situation,

 

I have got service running at https://my.company.com/SERVICE. But i need users to hit https://my.company.com/test/service and then i redirect them to https://my.company.com/SERVICE.

 

But the problem is i'm using branch rules in APM for "Source IP and Uri" lookup. Say Source IP is 100.X.X.X & URI i'm looking for is /test/service.

 

When i use redirection irule, HTTP_REQUEST executes before APM and when it reaches APM policy, the URI will be /SERVICE and APM will deny the request since its looking for /test/service.

 

I tried [ACCESS::policy result] eq "allow" but it didn't seem to work. Can someone provide me a full irule for this requirement.

 

Any help is much appreciated. Thanks in advance

 

2 Replies

  • just an option, you can do redirect from the visual policy editor, would that work for you?

     

  • Hi,

     

    Do you want to only rewrite first request or all requests.

     

    when working with events ACCESS_SESSION_STARTED, ACCESS_POLICY_COMPLETED and ACCESS_POLICY_AGENT_EVENT and with VPE operations, action is executed once during policy evaluation, but not for all following requests.

     

    If you want to execute a code for all requests, you can use HTTP_REQUEST (before APM evaluation) or ACCESS_ACL_ALLOWED (after APM evaluation)

     

    if you want to rewrite HTTP request URI and response data, you can use a rewrite profile instead of irules.