Forum Discussion
Irule help - encoding
I’ve attached the log output from a sample session. We’re getting the following (removed https:// to make the link not active and marked two sections in bold and blue to indicate where the error lies):
HTTP_REQUEST: newString2 1 {fss.stage.gecompany.com/fss/idp/startSSO.ping?PartnerSpId=webex.comACSIdx=2TARGET3dhttps3a2f2femeetings-test2.webex.com2femeetings-test22fj.php3fED3d14122433226UID3d101145530726PW3dNODBlNzAxNjE226RT3dMiMxMQ253D253D
If we plug in the missing ampersands and replace the encoded equals sign (3d) with an equals sign (red section) and percent signs (blue sections), we get the following:
https://fss.stage.gecompany.com/fss/idp/startSSO.ping?PartnerSpId=webex.com&ACSIdx=2&TARGET=https%3a%2f%2femeetings-test2.webex.com%2femeetings-test2%2fj.php%3fED%3d141224332%26UID%3d1011455307%26PW%3dNODBlNzAxNjE226RT3dMiMxMQ253D253D
That works perfectly. So, we just need to figure out why the & and = are being removed from $fssString and why the % signs are being removed from newstring2.
when HTTP_REQUEST {
break it up using ? as delimiter
set value for FSS/Ping string
build the new string using the F5 URI::encode command on the entire query string
Thanks in advance !!!
- hooleylistCirrostratusIt looks like you're using URI::encode to URL encode the query string. If that's not what you want to do, can you post the full logs from /var/log/ltm for a request, redirect and subsequent request that fails?
- Allan_Grah_3697NimbostratusThat is correct Hoolio - we are trying to Percent Encode using the URI::encode function.
- hooleylistCirrostratusHi Allan,
- Allan_Grah_3697Nimbostratus[u[Original:[/b[ federation.stage.gecompany.com/jsp/redirectWebEx.jsp?TARGET=https://emeetings-test2.webex.com/emeetings-test2/j.php?ED=141224332UID=1011455307PW=NODBlNzAxNjE2RT=MiMxMQ3D3D}
- Allan_Grah_3697Nimbostratusan external source was able to validate our iRule on a different version of code......so, that's good news for us right now.
- The_BhattmanNimbostratusYour external source is correct :-) I tested this on version v10 and v9.2 and it seems to be doing exactly what the irule is scripted to do. For some reason some of the ecoding is not working.
Let us know how it turns out
Bhattman
- hooleylistCirrostratusURI::encode seems to work correctly on 9.3.1 and 10.2.0:
when RULE_INIT { log local0. "[URI::encode http://test.example.com]" }
when RULE_INIT { This event is here just to show the intermediate values for the URI parsing set url_orig "http://federation.stage.gecompany.com/jsp/redirectWebEx.jsp?TARGET=https://emeetings-test2.webex.com/emeetings-test2/j.php?ED=141224332UID=1011455307PW=NODBlNzAxNjE2RT=MiMxMQ3D3D" log local0. "\$url_orig: $url_orig" set target [URI::query $url_orig "TARGET"] log local0. "\$target: $target" set target_encoded [URI::encode [URI::query $url_orig "TARGET"]] log local0. "\$target_encoded: $target_encoded" set target_redirect "https://fss.stage.gecompany.com/fss/idp/startSSO.ping?PartnerSpId=webex.com&ACSIdx=2&TARGET=[URI::encode [URI::query $url_orig "TARGET"]]" log local0. "\$target_redirect: $target_redirect" } when HTTP_REQUEST { Check if we need to rewrite this request? if {$some_condition == 1}{ HTTP::redirect "https://fss.stage.gecompany.com/fss/idp/startSSO.ping?PartnerSpId=webex.com&ACSIdx=2&TARGET=[URI::encode [URI::query [HTTP::uri] "TARGET"]]" } }
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