Forum Discussion

Erik_Hetenyi_36's avatar
Erik_Hetenyi_36
Icon for Nimbostratus rankNimbostratus
Jul 13, 2018
Solved

F5 APM redirect when the URI contains a # (hashtag) / URI fragmentation

Hi All,

 

I'm looking for some ideas or help on an issue with our setup. We are trying to enable the F5 APM module for a webapp and we are pretty much configured and setup except one little annoying issue.

 

If the URI looks like:

 

What happens in in almost every scenario is when a user is clicking on a hyperlink which has a querystring in it will be redirected to the homepage instead of the specific object or page he originally wanted to go.

 

Any help would be appreciated how to force the browser to send the full URI and store in the landinguri variable in the APM module.

 

Thanks!

 

  • Hi All,

    I thought I would share my solution to this problem. First iRule to capture the initial request without an authenticated session. This will throw back a simple javascript to the client and encode the URI which will replace the to %23 and will submit it again.

    if { ( [HTTP::uri] equals "ENTRYPOINT" ) and ( ! [ ACCESS::session exists -state_allow -sid [HTTP::cookie MRHSession] ] ) } {
         Respond with the 200
        HTTP::respond 200 content "
        
        
        "
    }
    

    The second part is to capture this URI and decode it back than update the landinguri in the access session.

    when ACCESS_SESSION_STARTED {
    if { [HTTP::uri] contains "%23" } {
        set tmpURI [HTTP::uri]
        ACCESS::session data set session.server.landinguri [URI::decode $tmpURI]
        }
    }
    

    This solution seems to work for us. But please let me know if anybody has any better idea. Thanks

4 Replies

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    The

    represents the URL fragment; everything after it, including the
    ?
    , which no longer represents a query string, is part of a fragment ID.

    The URL fragment is processed on the client side only, by the browser, and it is removed from the URL before the query is sent to the server by the browser.

    Setting the landing URL may not work well if there are two or more fragments referenced.

  • Hi All,

    I thought I would share my solution to this problem. First iRule to capture the initial request without an authenticated session. This will throw back a simple javascript to the client and encode the URI which will replace the to %23 and will submit it again.

    if { ( [HTTP::uri] equals "ENTRYPOINT" ) and ( ! [ ACCESS::session exists -state_allow -sid [HTTP::cookie MRHSession] ] ) } {
         Respond with the 200
        HTTP::respond 200 content "
        
        
        "
    }
    

    The second part is to capture this URI and decode it back than update the landinguri in the access session.

    when ACCESS_SESSION_STARTED {
    if { [HTTP::uri] contains "%23" } {
        set tmpURI [HTTP::uri]
        ACCESS::session data set session.server.landinguri [URI::decode $tmpURI]
        }
    }
    

    This solution seems to work for us. But please let me know if anybody has any better idea. Thanks

    • ArielSC's avatar
      ArielSC
      Ret. Employee

      Hi Erik, nice solution!

      I'm dealing with the same situation. Could you share the Javascript code that you used?