Forum Discussion
iRule for replace URL characters and do Base64 Encoding
Hi,
Is is possible to achieve the below scenario.
URL: www.example.com/xyz/xyz.do?asar=equal?x=xyzw.xyzw.abcd
The requirements:
- Check if the URL start with "www.example.com/xyz/xyz.do?asar=equal?x=".
- Replace the second "?" with "&".
- Encode anything after "x=" using the base64 algorithm.
Thanks in advance.
BR,
- Kevin_StewartEmployee
Certainly not the only option, but the following should work:
set hosturi [string tolower [HTTP::host][HTTP::uri]] if { $hosturi starts_with "www.example.com/xyz/xyz.do?asar=equal?x=" } { set firstpart [string range $hosturi 0 [expr [string first "?x=" $hosturi] + 2]] set secondpart [string rang $hosturi [expr [string first "?x=" $hosturi] + 3] end] log local0. [string map {"?x" "&x"} $firstpart][b64encode $secondpart] }
- Gbps_31870Nimbostratus
Thanks a lot kevin, I will test the iRule shortly and update you with the results .. Thanks again
BR
- Gbps_31870Nimbostratus
I made the below iRule which was mainly from your valuable inputs kevin and what I found in devcentral, and it seems to be working fine.
when HTTP_REQUEST {
Your inputs are really appreciated and helpful.
BR,
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