Forum Discussion
How add URL parameter
Hi guys,
I have to add a parameter at the end of the URI for all the HTTP requests.
My problem is that the request URI could contain some parameter. How I can add a new one whether there is already parameters in the URI?
I wrote the following iRule and it works, but is not so elegant...
when HTTP_REQUEST {
if { [HTTP::uri] contains "?" } {
HTTP::uri [HTTP::uri]¶meter=abc
} else {
HTTP::uri [HTTP::uri]?parameter=abc
}
}
Any other ideas?
Thanks!
3 Replies
- Michael_Jenkins
Cirrostratus
I think the way that you have it is probably the easiest (best) way. There have been a couple other questions on this same topic, like this one, and those generally agree with your approach.
- joan_luque_1763
Nimbostratus
Hi Michael J,
I have looked for a while a best solution but I only found this one. I would like found some kind of macro to just add a new parameter in the URL without a previous check.
Thanks anyway!
- Michael_Jenkins
Cirrostratus
Would be nice to have, i agree. There is the possibility of creating a custom procedure that could do this for you (see this article on procs: https://devcentral.f5.com/s/articles/getting-started-with-irules-procedures), but it may not be worth it unless you have a lot of instances like this and want to reduce code.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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