26-Oct-2022 01:36 - edited 26-Oct-2022 02:01
Hello everyone,
I'm having this issue where APM-protected content fails to start APM session if called from an iFrame.
The access session starts at client request time as expected, and I can see that APM responds with the redirect to /my.policy setting unique access session cookies (MRHSession, LastMRH_Session) .
I have noticed that when iframe tries to load GET /my.policy request, it does not retain those cookies, which I suspect being the reason request fails.
My access session times out with 0 received packets, from packet capture I see APM redirects client to /my.logout.php3?errorcode=19 page and on iFrame content I see APM page with "Access Denied" message.
Has anyone had this issue before? Any input is appreciated.
Solved! Go to Solution.
13-Dec-2022 06:57 - edited 13-Dec-2022 06:59
So we did some more testing, and this is not going to work.
We've worked with support and experimented with iRules to insert additional headers and cookies into the response, but the behaviour of CORS is that these are always going to be removed. And because APM relies heavily on cookies to function, it does mean that accessing APM-protected content from an iFrame will fail to work.
26-Oct-2022 02:21
Hi,
I believe I came across a similar case, you may want to check this link,
https://community.f5.com/t5/technical-forum/apply-apm-to-an-iframe-the-content-cannot-be-display-in-...
The comment with the resolution, stated the below,
i found the way to prevent the dialog breaks out of the frame :
26-Oct-2022 02:27
Thanks for the very fast response. Will try this out and let you know.
27-Oct-2022 02:21 - edited 27-Oct-2022 02:22
@momahdy I'm running BIG-IP version 16, logon.inc seems related to previous software versions and I have not found similar code in other ".inc" pages within advanced APM policy configuration menu.
29-Oct-2022 01:35
@CA_Valli I tried a quick lab with v16.1.2 and can find it in line 140 this is using standard type not the modern type. in case issue still persist it would be very helpful to raise a case to support so that they can better inspect your environment specifically.
13-Dec-2022 06:57 - edited 13-Dec-2022 06:59
So we did some more testing, and this is not going to work.
We've worked with support and experimented with iRules to insert additional headers and cookies into the response, but the behaviour of CORS is that these are always going to be removed. And because APM relies heavily on cookies to function, it does mean that accessing APM-protected content from an iFrame will fail to work.
04-Jan-2023 07:20
Sorry about this! One thing.. and sorry I didn't see this until now.. one-connect on the VIP. Did support have you try this?
05-Jan-2023 02:59
Hello Aubrey, thanks for your input.
We haven't tried Oneconnect, but since APM is in place and we're getting errors at authentication time, the BIG-IP never really forwards these packets to back-end anyways.
06-Jan-2023 07:53
Did support give any idea on whether or not a fix for this was on the horizon in code release?
06-Jan-2023 11:41
Hello Aubrey, we've agreed with support on building a workaround to this.
We haven't discussed software fix.
Regards
CA
18-Apr-2023 07:41
18-Apr-2023 08:45
Hello @Jonathan_c
the 'workaround' was disabling APM access for that request via iRule, so that iFrame loads all components.
In our case backend server runs 401 NTLM auth which was originally supported through APM and returns classic auth template when APM is disabled.
18-Apr-2023 11:47
Thanks 🙂
12-May-2023 02:50
Hello @CA_Valli ,
Thank you for sharing all this information it very helpfull.
Do you mind to share how did you achieve this (Irule, specific config ...)?
Thank you very much
12-May-2023 03:35 - edited 12-May-2023 03:41
iRule kinda looks like this.
I suggest you to raise a support case if you need specific tuning.
when HTTP_REQUEST {
if { $host eq "apmprotected.mybusiness.com" && [HTTP::header exists "Referer"]}{
set referer_host [string tolower [URI::host [HTTP::header "Referer"]]]
if { $referer_host ne "partnerportal.company.com" && $referer_host ne "apmprotected.mybusiness.com"}{
# iframes in unauthorized portals get redirected to main auth
# notice I had to include my own portal as "authorized" to correctly load scripts,css,etc.
HTTP::respond 302 Location "https://apmprotected.mybusiness.com/"
} else {
# i have a big list of IFs here to match specific conditions
ACCESS::disable
}
}
}