Forum Discussion
brownie6969_121
Nimbostratus
May 31, 2012redirect irule
our old application url that pointed to the F5 vip was mybicrt.company.com. The new code is mybicrt.company.com/analytics. i created the following that achieves that part of ithttps://mybicrt.company.com/saw.dll?Dashboard&PortlPath/shared/Executive/_portal/Executiveand we need them to redirect tohttps://mybicrt.company.com/analytics/saw.dll?Dashboard&PortlPath/shared/Executive/_portal/Executive
when HTTP_REQUEST {
if { [HTTP::path] equals "/" } {
HTTP::redirect "/analytics/"
log local0. "redirect"
}
}
now the problem is that users have links to dashboards saved that look like this
basically the irule we have setup stops at analytics and I need a way to add /analytics after mybicrt.compan.com but keep the rest of the url there. Also there are a ton of dashboard links that are all different.
is this possible.
Thanks
Andrew
24 Replies
- nathe
Cirrocumulus
In line with what hoolio said, could you post the fiddler/httpfox output? Or even using curl on the box? Would v much help.
N - Gbps_31870
Nimbostratus
The problem is with HTTP::path equals "/" as this statement only match the part which is working, you should cover the other scenario "/saw.dll" to get it works.
Try this
when HTTP_REQUEST {
switch [string tolower [HTTP::path]] {
"/" -
"/saw.dll" {HTTP::redirect "https://[HTTP::host]/analytics[HTTP::uri]"}
}
}
HTH - brownie6969_121
Nimbostratus
thanks for all the help guys but i am still experiencing the issue. the initial redirect works but dashboard links still don't.
Thanks
andrew - Gbps_31870
Nimbostratus
As what Aaron & Nathan mentioned, it would be helpful to provide HTTP request/response logs to know what's going on.
Abdul - Michael_Yates
Nimbostratus
Hi Brownie6969,
It looks to me like you are just trying to change the sub-directory (adding "/analytics"), which should not require a redirect.
Would something like this work for you?when HTTP_REQUEST { switch -glob [string tolower [HTTP::path]] { "/" - "*/saw.dll" { HTTP::uri "/analytics[HTTP::path]" } } }
Hope this helps. - brownie6969_121
Nimbostratus
thanks Michael. i tried that and now the initial link doesn't work
Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. - Michael_Yates
Nimbostratus
Sorry,
I have to correct myself. I didn't read the original request.
From: https://mybicrt.company.com/saw.dll?Dashboard&PortlPath/shared/Executive/_portal/Executive
To: https://mybicrt.company.com/analytics/saw.dll?Dashboard&PortlPath/shared/Executive/_portal/Executive
This should fix your issue (change HTTP::path to HTTP::uri since the path does not include the HTTP::query, where the HTTP::uri does, so this should inject the directory that you need and append the rest).
So HTTP::path to detect the saw.dl (you could also use URI::basename to be even more specific)l value and HTTP::uri to complete the full URL to send to the server.when HTTP_REQUEST { switch -glob [string tolower [HTTP::path]] { "/" - "*/saw.dll" { HTTP::uri "/analytics[HTTP::uri]" } } }
Let us know if this works.
Hope this helps. - brownie6969_121
Nimbostratus
the one you just sent didn't work but i changed path to uri in the first part and then the initial redirect worked but same issue with the dashboard link.
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/" - "*/saw.dll" { HTTP::uri "/analytics[HTTP::uri]" } } }
Thanks
Andrew
Also i will attach logs soon. I really appreciate all the help guys. - Eric_St__John
Employee
Give this a shot:when HTTP_REQUEST { if { !([HTTP::path] starts_with "/analytics") } { HTTP::redirect "/analytics[HTTP::uri]" } }
Regards,
Eric - brownie6969_121
Nimbostratus
estjohn
the redirect works for both first redirect and within the dashboard (analytics gets placed in link) but the display is all messed up and images aren't displaying. any idea why the irule would do that?
so close i can almost taste it. estjohn you are about to make my Friday afternoon awesome.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
