Forum Discussion

Mohanad's avatar
Mohanad
Icon for Cirrostratus rankCirrostratus
Sep 14, 2021

Session Persistence based on http header value using iRule

Hello Kindly i need to apply Session Persistence based on http header : Payment application working as follow: At first request (Login) the server response with http header named "X-Token" with "...
  • xuwen's avatar
    Sep 16, 2021

    when HTTP_RESPONSE {

    if { [HTTP::header exists "X-Token"] } {

    if { [HTTP::header "X-Token"] != "" } {

    persist add uie [HTTP::header "X-Token"]

    }

    }

    }

    when HTTP_REQUEST {

    if { [HTTP::header exists "X-Auth-Token"] } {

    set value [persist lookup uie [HTTP::header "X-Auth-Token"]]

    log local0. "value is $value"

    if { $value != "" } {

    persist uie [HTTP::header "X-Auth-Token"]

    }

    }

    }