Skip to content

Overwriting Fields in iRule #49

Description

@davidpean

I am trying to verify that a URI rewrite is occuring -- Is it expected that you are unable to overwrite a field that you already set in the test with an iRule? For example:

iRule:

rule simple {

  when HTTP_REQUEST {
    HTTP::uri "/foobar"
  }

}

Test:

it "rewrite example" {
  event HTTP_REQUEST
  on HTTP::uri return "/foo"
  verify "URI is rewritten to" "/foobar" eq {HTTP::uri}
  run resources/simple_irule.tcl simple
}

in the debug, it looks like the value is getting set

debug HTTP::uri set: /foobar

However, when the verify executes it goes back to what was set in the on

info Returning value '/foo' for procedure call 'HTTP::uri'

error Verification 'URI is rewritten to' failed - expression: {/foobar} eq {/foo}

I know there is an issue trying to overwrite when using before statements, but wasn't sure if it was possible in the actual iRule. Any help would be much appreciated!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions