26-Feb-2023 05:29 - edited 26-Feb-2023 10:30
Dears i need help !!!!!!!
I have a Url lets say https://abc.com/product/#/motor/lead when clients access this url , it assigns a "tmx" in the middle of the url.
What i want is when the clients access the below url
https://abc.com/product/?tmx=1676539770970#/motor/lead
Notice that “?tmx=1676539770970” is coming in the middle, while i want it to be at the end to be like this
https://abc.com/product/#/motor/lead?tmx=1676539770970
26-Feb-2023 08:13
@mj16othman It seems like this is the application inserting the text in the incorrect location of the URI if you have to reorder it. For simplicitys sake I recommend working on the application to insert the text in the appropriate location rather than doing this in an iRule as a bandaid. Now once you have explored that avenue of change and you are 100% that it cannot be done in the application then I would do it in an iRule. In order to configure this rule a bit easier, do you know the length that the string will always be or is this a string that is random in length but always starts with a ? and end with a #? Will this value only ever be integers from 0 t 9?
26-Feb-2023 10:27
hi paulius
yes the string will always come after the ? The real length will always be 13 integers example tmx=1676539770970
26-Feb-2023 13:30 - edited 26-Feb-2023 13:31
@mj16othman I think the following might do what you want but I'm not 100% so you might want to test this before putting it into production.
when HTTP_REQUEST priority 500 {
if { [HTTP::uri] starts_with "/product/?tmz=" } {
set PATH_TO_MOVE [string range [HTTP::uri] [expr {[string first "?tmz=" [HTTP::uri]] + 5}] 13]
set REMOVE_CONTENT [string map [list "\?tmz=[0-9]{13}" "" ] [HTTP::uri]]
HTTP::redirect http://[HTTP::host]${REMOVE_CONTENT}/?tmz=${PATH_TO_MOVE}
}
}
27-Feb-2023 02:52
Rewriting on the F5 isn't possible. The hash-sign is called a 'fragment' and sometimes called an 'anchor'. They are used localy inside the webbrowser and are not send in the HTTP request. Therefor the '#/motor/lead' can't be rewritten as it does not reach the F5.
For more detailed information about the fragement URLs, see: https://blog.httpwatch.com/2011/03/01/6-things-you-should-know-about-fragment-urls/
12-Mar-2023 04:51
@mj16othman can you tell how you proceeded?