Forum Discussion
Persistence based on XML data
All,
Working on an issue where we need to persistence when user disconnects from the wored network to a wireless network and their IP changes. The application is a CRM that does not allow cookie insertion and does not have a sessionid or jsession that I can base session persistence on. When a user opens this application I can see the below data in the stream and was wondering if we can utilize universal or hash persistence based on the userId or uuid fields in the xml content. Is this possible and would it be a simple irule to create? Does anyone have an example by any chance.
POST /application/solarsessionmanagement/ClientSessionService HTTP/1.1
Accept: text/xml, multipart/related
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
User-Agent: xxxxxxxxxx
Host: xxxxxxxxxxx
Connection: keep-alive
Content-Length: 655
<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:callSubroutinesWithAddlData xmlns:ns2="http://www.eclipseinc.com/application/solarsessionmanagement"><arg0><userId>testuser</userId><uuid>330a48d6-4021-388d-a291-7a1d22171eb3</uuid><sessionType>Solar</sessionType></arg0><arg1><skipRetryAndClose>true</skipRetryAndClose><subroutineArray><uvSubroutines>AAAXU09MQVIuSjJFRS5TRVQuVFRZLkRBVEEAAAEyAAAAAAAA</uvSubroutines><uvSubroutines>AAAQUkVBRC5DT05UUk9MLlJFQwAAATYAAAAAABJNU0cuTk9USUZZLk9QVElPTlMAAAAAAAAAAAH9AAAA</uvSubroutines></subroutineArray></arg1></ns2:callSubroutinesWithAddlData></S:Body></S:Envelope>
- Vijay_E
Cirrus
It has been a while since I tested this iRule out. However, I have used it in the past successfully in 10.x and 11.x code version. The code provides persistence based on jsession id for GET request and xml data for POST request.
You would have to alter the code to suit your specific needs:
when HTTP_REQUEST {
set HOST [string tolower [HTTP::host]]
set SRCADDR [IP::remote_addr]
if { $HOST contains ".v." }{
if { [HTTP::method] equals "GET" } {
set SESSIONID [findstr [HTTP::uri] "uuid=" 5 20]
set KEY [crc32 $HOST$SESSIONID]
persist hash $KEY 30
} elseif { (([HTTP::method] equals "POST") and ([HTTP::uri] contains "/amm/ampxml.jsp")) } {
if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048}{
set CONTENT [HTTP::header "Content-Length"]
} else {
set CONTENT 1048
}
if { $CONTENT > 0 } {
HTTP::collect $CONTENT
}
} elseif { $HOST contains ".suit.domain.com" } {
pool POOL-suit
set KEY [crc32 $HOST$SRCADDR]
persist hash $KEY 14400
} elseif { $HOST contains ".suit.vf.com" } {
pool POOL-vf-suit
set KEY [crc32 $HOST$SRCADDR]
persist hash $KEY 14400
}
}
}
when HTTP_REQUEST_DATA {
if { (([HTTP::method] equals "POST") and ([HTTP::uri] contains "/amm/ampxml.jsp")) } {
set HOST [string tolower [HTTP::host]]
set SESSIONID [findstr [HTTP::payload] "uuid=" 5 20]
set KEY [crc32 $HOST$SESSIONID]
persist hash $KEY 30
}
}
- Dave_Pisarek
Cirrus
Thanks for the response. I will need to test this out and let you know how It went
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