Forum Discussion
Mike_Pones_6391
Nimbostratus
Jun 01, 2006HTTP_URI Lookup Problem
I currently have a rule setup to look for the word "ecommerce" and then make a redirect to HTTPS. Here is the rule:
if (http_uri contains "ecommerce") {
redirect to "https://%h/%u"
}
But what I am looking to do is ONLY have it look past the domain name, for example "http://www.myurl.com/ecommerce". But it is actually redirecting even if "ecommerce" is anywhere in the URL. Like "http://www.myurl.com/um/user/showUserRegister.do?hello=ecommerce". How can I ONLY have it look directly after the domain?
Thanks,
Mike
4 Replies
- Deb_Allen_18Historic F5 AccountHi Mike -
You can use the "getfield" function to split the URI string into 2 parts, split on the "?" character:if (getfield (http_uri, '?', 1) contains "ecommerce") { redirect to "https://%h/%u" }
(v9 introoduced a new command "HTTP::path" to extract only the URI path & filename without the trailing query parameters)
HTH
/deb - Mike_Pones_6391
Nimbostratus
deb, thanks for the quick reply.
Since I an not too familier with url "stuff". Why would you chose to split it at the "?", is that common?
Thanks,
Mike - Deb_Allen_18Historic F5 AccountGeneric URI syntax uses the ? character to delimit the start of the query string.
By splitting on the ?, you create 2 fields: the part before the ?, which is the actual resource being requested; and the part after the ?, which contains the query.
From RFC 3986 (URI Generic Syntax): Example URI with component parts:http://www.example.com:8042/over/there?name=ferretnose \__/ \__________________/\_________/ \_________/ \___/ | | | | | scheme authority path query fragment - Mike_Pones_6391
Nimbostratus
Interesting I did not know that. I will give this a shot.
Thanks again,
Mike
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
