Forum Discussion

Brett_Hanson_95's avatar
Brett_Hanson_95
Icon for Nimbostratus rankNimbostratus
Jul 26, 2016

Redirecting a URL that shares a common pre-# path but is an entirely different page - https://fqdn/myaccount/#/forms/moving

Hoping someone can help with a redirect on a URL entered into the browser that contains a

I've seen a few posts talking about this and the general consensus is that the is NOT sent to the server/F5. I can see this is the case when reviewing logs and intercepting traffic. My main issue here is that I'm seeing the inclusion of the "" in the URL is altering which page is actually delivered - rather than taking someone to a anchor/segment within the page that lives at the URL pre-.

NOTE: We have Glassfish in the back end.

We need to redirect...

FROM:

https://fqdn/myaccount//forms/moving
TO:
https://fqdn/moving.html

To demonstrate, with NO redirects in place at all, we see the following behaviour when attempting to navigate to variations of the URL:

FAILS (returns Glassfish 404 error):

https://fqdn/myaccount/forms/moving

SUCCESS (goes to the myaccount page as expected)

https://fqdn/myaccount/

SUCCESS (goes to a page about moving - the old page we want to redirect away from):

https://fqdn/myaccount//forms/moving

Problem is that nothing after the goes through in the request and the path is actually /myaccount As we don't want to redirect /myaccount - does anyone know how to make this happen?

Cheers, Brett

2 Replies

  • Hi,

     

    The behavior observed is normal. The is an anchor and is just used by the browser, You need to manage this using javascript on the application side.

     

    Everything after the anchor is never sent to the backend.

     

  • Hi Brett,

    since I've seen your comment in the https://devcentral.f5.com/questions/redirect-uri-with-symbol post I'll skip the tutorial of URI fragments... 😉

    Well, the only option you have to support your requirements would be to use a

    STREAM::expression
    to rewrite the fragmented URIs before its getting send to your clients. With STREAM you could either translate the URI from...

    https://fqdn/myaccount//forms/moving

    ... to ...

    https://fqdn/myaccount/?fragment=%2fforms%2fmoving/forms/moving

    ... or directly to ...

    https://fqdn/moving.html

    The first approach would store the URI-Fragment in an additional URI-Query, so that the client would send the URI-Fragment identifier back to your load balancer. In this case you could use an iRule to inspect the URI-Query containing the embeded fragment identifier to finally trigger the redirect (good approach when dealing with lots of fragments)

    The second approach will directly translate the original URI to the redirect location.

    FYI: If the the fragmented URI is also send via HTTP redirects, then you have to inspect and translate the "Location" HTTP-header, too.

    Cheers, Kai