Would like to assign a session var and add to an https header

I’m completely new to F5/BIG-IP and have been assigned to work with our Network team to integrate an application SSO solution with the existing iRule. The network team only do basic re-directs and are intimidated at going beyond the working iRules. From my research this does not appear to be too difficult. What we need to do is assign a session variable to a local var and insert it into the header. I’m thinking it should look something like this:

when HTTP_REQUEST { set inbound_uri [string tolower [HTTP::uri]] set mycustom_var[ACCESS::session data get “session.logon.last.username”] HTTP::header insert $mycustom_var if { $inbound_uri starts_with “Blah” } {HTTP::redirect }

}

Any assistance will be much appreciated,

The session variable I am trying to add is the MS AD logon User_ID - server variables that contain this data are LOGON_USER and AUTH_USER. From my reading it looks like this data is stored in “session.logon.last.username”. The application is looking for this value in the custom var in the header. Hope this is helpful.

First of all you tagged your question as ASM when it really should be APM (different product/module). Basically you are on the right track, but with caveats as APM session needs to exist before you can read session data.

Check out the DevCentral - An F5 Technical Community for usage examples