Forum Discussion
Redirecting URL with #
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:
...//fqdn/myaccount//forms/moving
TO: ...//fqdn/moving
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):
...//fqdn/myaccount/forms/moving
SUCCESS (goes to the myaccount page as expected)
...//fqdn/myaccount/
SUCCESS (goes to a page about moving - the old page we want to redirect away from):
...//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
- JG
Cumulonimbus
"" is a reserved character denoting a "fragment identifier component", the processing of which is a client-side operation. See rfc3986.
In the case you have described,
...//fqdn/myaccount//forms/moving
works when the primary resource, i.e. the default index page in the directory "/myaccount", which can be "index.html" depending on the configuration of your Web server, is available, which accounts for the two success situations you have described above.
...//fqdn/myaccount/forms/moving
fails because there is no primary content page in the directory "/myaccount/forms/moving" on your Web server.
Based on the information you have provided, a redirect from:
...//fqdn/myaccount//forms/moving
to:
...//fqdn/moving
can be achieved by setting up an HTTP header in the server response to any request for a resource in the directory "/myaccount" at your Web server:
Location: /moving/
. BTW, the browser should also append the original fragment identifier automatically if that's also what you want. See s7.1.2 of rfc7231.
If you want to utilize irules, here's a simple one:
when HTTP_REQUEST { if {[HTTP::uri] starts_with "/myaccount"} { HTTP::respond 301 Location "/moving/" } }
.
Hi Brett,
Yann Desmarest and I already told you two possible solution to support your fragment redirection requirement...
https://devcentral.f5.com/questions/redirecting-a-url-that-shares-a-common-pre-path-but-is-an-entirely-different-page-https-fqdn-myaccount-forms-moving-47859
Cheers, Kai
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