Forum Discussion
ASM redirect on api call, does not generate a redirect for a user
- Apr 11, 2018
So I have sorted out a solution to this albeit not very graceful. I could not get a popup of any type to display. What i did, in the custom response, Dropped a cookie, on the client machine, than on the next request read the cookie with an IRUle and deleted it, forcing a redirect to the block page at that point in time, and passing the support ID through the cookie i had created.
Not very graceful, as it doesnt redirect to the support page instantly, but it shows the support page afterwards. Bit of a hack, issue is that each request redirected by the Location: 302 redirect that works successfully does not delete the cookie, so the support page needs to also delete the cookie to stop repeated redirects.
irule:
when HTTP_REQUEST { set block_is_set [HTTP::cookie exists "Block-Cookie"] if {$block_is_set == 1} { set support_id [HTTP::cookie value "Block-Cookie"] HTTP::cookie remove "Block-Cookie" HTTP::respond 302 noserver Location "https://supportpageDomain/URLPath?support_id=$support_id" Connection close Set-Cookie "Block-Cookie=;expires=Thu, 01 Jan 1970 00:00:00 GMT" } }
Custom Response Header:
HTTP/1.1 302 OK Cache-Control: no-cache Pragma: no-cache Location: https://supportpageDomain/URLPath?support_id=<%TS.request.ID()%> set-cookie: Block-Cookie=<%TS.request.ID()%>; Path=/; HttpOnly; Secure
I have thus come up with a solution, although a crude one. No popup of any kind would show for me. What I entered as a custom answer was I dropped a cookie on the client computer, read it with an IRUle during the subsequent request, and then destroyed it, forcing a redirect to the block page and allowing the support ID to be sent through the cookie I had set. Not very smooth because the assistance page isn't displayed right away but rather appears later. It's a bit of a hack because each request that is properly htaccess redirect by the Location: 302 redirect leaves the cookie behind; thus, the help page must likewise remove url.
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