Forum Discussion
How to make a branch decsision based on HTTP header in an Access Policy?
Hello everyone,
I have to make a branch decision in an Access Policy based on the value in the HTTP header field 'host'. For example, if [HTTP::host] matches foo.example.com a given branch (like passway) should be followed. Otherwise 'fallback' should be used.
I'm not trained in creating iRules and do not know how to make this branch decsision otherwise. It would be great if someone could give an example on which item in the access policy to use and could provide a sample snippet explaining how the above decsision could be made.
Thanks in advance,
Joerg
1 Reply
- Stanislas_Piro2
Cumulonimbus
Hi,
HTTP Host header is already provisioned in a Access variable:
session.server.network.name
You van use this branch expression:
expr { [mcget {session.server.network.name}] == "foo.example.com" }
if you want to collect another HTTP header, don't use iRule Event but this irule code:
when ACCESS_SESSION_STARTED { ACCESS::session data set session.custom.myHeader [HTTP::header myHeader] }
This ACCESS_SESSION_STARTED raise just before Access session redirect to /my.policy
This event is the best time to catch first request content (HTTP headers, URI, query string, HTTP Method, ...)
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com