Forum Discussion
Aaron_Magruder_
Nimbostratus
Mar 30, 2005Removing / inserted by iRule variable
Is there a way to prevent the / from being inserted when using variables? The following iRule works to redirect users from /29900 to /Templates/IQuote010.cfm?ID=/29900. I need a way to remove the / between ID=/29900 so the uri looks like /Templates/IQuote010.cfm?ID=29900.
/29900 (initial uri)
/Templates/IQuote010.cfm?ID=29900 (uri should look like this)
/Templates/IQuote010.cfm?ID=/29900 (need to remove the /)
when HTTP_REQUEST {
set uri [HTTP::uri]
set host [HTTP::host]
set new_uri /Templates/IQuote010.cfm?ID=
set new_url $host$new_uri$uri
if { [HTTP::uri] starts_with "/Templates" } {
use pool UITShared-172-29-98-77
}
else {
HTTP::redirect http://$new_url
}
}
- unRuleY_95363Historic F5 AccountTry changing the "set uri" line to:
set uri [string trimleft [HTTP::uri] "/"]
- Aaron_Magruder_
Nimbostratus
Thanks. This worked like a champ. I think there is a better way to accomplish this but I'm not sure how. The current way I have configured it, I will need to include any new directories in the rule. We would like to look for 5 digits in the uri. If there are only 5, then we would like to redirect to /Templates/.... Everything else would use the pool. This would prevent use from having to add new directories to the rule. - JRahm
Admin
Would this work? Sorry, I don't have a pair with which to test right now, F5 pried our evaluation units out of our hands last Friday. Hopefully a PO will be cut soon. - JRahm
Admin
I think that can be chopped down: - Aaron_Magruder_
Nimbostratus
Neither of those options worked. The LTM didn't send the redirect. - JRahm
Admin
In this line:
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