Forum Discussion
Redirect :: URI with # symbol
Have a URI that has "//hello"
We are looking to redirect anything that comes in with this to another URL. Here is what we have so far:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "" } { HTTP::redirect "https://siteb.com/" } else { } }
We see that the iRule is Executed via our stats; however, the site is never redirected. Any thoughts on why this would not redirect?
6 Replies
Hi Dan,
in the URI world the Hash-Sign () is called a "Fragment" and suppressed from sending by every browser.
scheme:[//[user:password@]host[:port]][/]path[?query][fragment]
So everthing after the Hash-Sign never hits the wire and therefor never reaches your F5.
Cheers, Kai
- Stanislas_Piro2
Cumulonimbus
Hi,
your irule is not working for 2 reasons:
- is not sent to the server
-
HTTP::host does not contain URI... in the request "" :
- [HTTP::host] is www.sitea.com
- [HTTP::uri] is /
The good syntax may have been (concatenate both variables):
when HTTP_REQUEST { if { [string tolower [HTTP::host][HTTP::uri]] equals "www.sitea.com//hello" } { HTTP::redirect "https://siteb.com/" } }But this is not possible... is a Fragment identifier managed locally by the browser, never sent to the server...
- Root44
Altostratus
Hello folks,
I thought "contains hello" will also work. Can anybody correct me?
Thanks, R
Hi Root,
in this specific scenario "contains hello" wouldn't work either, since everything byte after the hash-sign is getting excluded from the browsers HTTP request.
URL in the address Bar : Url requested from server: www.sitea.com/
The portion after the hash-sign is called "fragment" and a pure client site functionality to select or scroll down to a specific section of the requested ressource.
For more information refer to: https://en.wikipedia.org/wiki/Fragment_identifierBasics
Note: The Basics fragment of the Wiki site causes your Browser to jump to the section containing the code 'id="Basics"'
To see what the browser is sending I'd recommend to use either Fiddler, HTTP-Watch or dump the entire HTTP request using iRules (e.g. "log [HTTP::request]"). Any of the tools would show you, that the client isn't even sending "/hello" to the server. And if this string is not send by the client the F5 can't make additional decissions based on this string, right?
Cheers, Kai
- Brett_Hanson_95
Nimbostratus
I'm seeing the inclusion of the "" in the URL, entered into the browser, altering which page is actually delivered. NOTE: We have Glassfish in the back end.
With NO redirects in place at all, we see the following behaviour when attempting to navigate to variations of the URL (just for demonstration purposes): FAILS (returns Glassfish 404 error): https://fqdn.blah.blah/myaccount/forms/moving
SUCCESS (goes to a page about moving - the old page we want to redirect away from): https://fqdn.blah.blah/myaccount//forms/moving
SUCCESS (goes to the myaccount page as expected) https://fqdn.blah.blah/myaccount/
We need to redirect... FROM: https://fqdn.blah.blah/myaccount//forms/moving TO: https://fqdn.blah.blah/moving.html
Problem is that, as you say, nothing after the goes through in the request and the path is actually /myaccount As I don't want to redirect /myaccount - does anyone know how to make this happen?
Cheers, Brett
please start a new question.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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