Forum Discussion
Albert__Tase_70
Nimbostratus
Aug 03, 2010adding to a redirect
Hello need some help trying to grab a piece of the uri and append it to the redirect
for example user goes to www.bbb.com wants to get redirect via a 301 to https://bbb.com/yyyy and if the users adds
www.bbb.com/nnn they want to append that to the https://bbb.com/yyy/nnn got the basic syntax just cannot seem to figure out how to add the uri to the redirects uri for anything after the /yyy.
any Ideas ?
thanks
- hoolio
Cirrostratus
Hi Al, - hoolio
Cirrostratus
I don't think user-agents will include anchors in the request sent to the web app. The browser should make a request using the URI minus the anchor and then use the anchor to go to a specific section in the page. You can test this by logging the HTTP::uri value for a request like https://www.example.com/xyx/trackingid=8888 and see if the URI is logged as / or /xyx/trackingid=8888. - Albert__Tase_70
Nimbostratus
ok but how ? - Colin_Walker_12Historic F5 AccountIt sounds like all you're trying to do is redirect to a second host name, preserving the URI, but making sure that no matter what the URI was, it starts with /xyz/ first. Your concern is that you don't want to end up with a URI that starts with /xyz/xyz/, right? A simple if clause will solve that problem for you.
when HTTP_REQUEST { if {[HTTP::uri] starts_with "/xyz" } { HTTP::redirect "http://example2.com[HTTP::uri]" } else { HTTP::redirect "http://example2.com/xyz[HTTP::uri]" } }
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