Forum Discussion
Creating iRule for Persistence Profile
Dear Community,
Could you assist me in creating an iRule for a Persistence Profile requirement related to an SSO application? When users access our application via desktop, they are presented with a QR code for scanning through a mobile app to authenticate and gain access. The issue arises when, after browsing the website from the desktop (with the session routed to one node via F5 LTM), another request from the mobile app after scanning the QR code is routed to a different node. Ideally, both requests should be directed to the same node.
To resolve this, the iRule needs to compare the var topic parameter with the QR_AUTHENTICATION_CHANNEL_ID from the mobile request and ensure both are directed to the same node
attached is the screenshot of the code
and HTML code of the website
/*<![CDATA[*/
var endpoint = "\/qr-websocket";
var topic = "80f95f6f-cecf-4ab6-a70b-1196194e4baa";
var prefix = "\/qrtopic";
var stompClient = null;
$(function () {
var socket = new SockJS(endpoint);
stompClient = Stomp.over(socket);
stompClient.connect({}, function (frame) {
stompClient.subscribe(prefix + '/' + topic + '/verify', function (result) {
console.log(result.body);
let body = JSON.parse(result.body);
if (body.error) {
$("#qrerror").show();
} else if (body.success) {
stompClient.disconnect();
$("#qrerror").hide();
$("#qrform #token").val(body.token);
$("#qrform #deviceId").val(body.deviceId);
$("#qrform").submit();
}
});
});
});
/*]]>*/
Regards
Omran Mohamed
- Stefan_KlotzCumulonimbus
Dear Omran,
sounds like you need a universal persistence profile and an iRule similar to this discussion.
Just replace the header value with your "QR_AUTHENTICATION_CHANNEL_ID".
Hope that helps!
Regards Stefan :)
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