utf-8
5 Topics[Workaround]: Prevent iRule Managers to accidentally enter invalid characters into a Data Group
We realized some time ago that the BIG-IP GUI does not handle UTF-8 encoded strings very well in Data Groups which result in ever growing data records for everytime the Data Group is saved. This is an example on how to reproduce the problem and to see it in action: Start by creating an empty new data group named TEST of the type string. Add a line with the key test1 and the value abcåäö123 (copy and paste if you don't have a nordic keyboard) Click finish Check with tmsh list ltm data-group internal TEST You will see that it doesn't handle the UTF-8 data and you will se two characters for each > 7-bit character. Now go to the GUI again and add a second line with the key test2 and the same value abcåäö123 Click update Once again check tmsh and you will see that not only has test2 been added but test1 has also been updated, now including even more wrong characters. This is a screenshot of how it will look: The result of this is that eventually you will receive the following error from the BIG-IP (even if you only update lines that are not containing 8-bit ascii characters). Workaround Luckily we require the iRule Managers to login to an APM portal (webtop) where we have published a Portal Access to the administrative GUI of the BIG-IP, and since we do that, we can inject some JavaScript the will check the data before it saved. iRule PREVENT_INVALID_DATA_IN_DATAGROUP-IRULE This iRule will inject some JavaScript code that will prevent these mistakes from happening when HTTP_REQUEST { set inject_code 0 if {[HTTP::path] ends_with "/tmui/tmui/skins/Default/scripts/skin.js"} { set inject_code 1 STREAM::disable HTTP::header remove "Accept-Encoding" } } when HTTP_RESPONSE { if {$inject_code == 1} { set s1 "this.form.submitError\ =\ formSubmitError;" set r1 "this.form.submitError\ =\ formSubmitError;\n" append r1 "if\ (document.location.href.indexOf('datagroup')\ >\ -1)\ {\n" append r1 "select\ =\ document.getElementById('class_string_item');\n" append r1 "if\ (select\ !=\ null)\ {\n" append r1 "console.log('We\ found\ the\ select');\n" append r1 "for\ (option\ of\ select.children)\ {\n" append r1 "key\ =\ option.value.substr(0,\ option.value.indexOf('\\\\x0a'));\n" append r1 "if\ (!\ /^\[\\x00-\\x7F\]*\$/.test(key))\ {\n" append r1 "alert('String\ \"'+key+'\"\ contains\ invalid\ characters!');\n" append r1 "return\ false;\n" append r1 "}\n" append r1 "if\ (!\ /^\[\\x00-\\x7F\]*\$/.test(option.value))\ {\n" append r1 "alert('Value\ of\ \"'+key+'\"\ contains\ invalid\ characters!');\n" append r1 "return\ false;\n" append r1 "}\n" append r1 "}\n" append r1 "}\n" append r1 "}\n" STREAM::expression "@$s1@$r1@" STREAM::enable } } Now if you add a streaming profile to your APM Virtual Server and add this iRule the user will be presented with a popup informing them about the invalid data and also prevent them from submitting it. Hope this can be of help until F5 fixes this in the BIG-IP1.2KViews2likes1CommentSet Content-Type to UTF-8 with iRule
If someone would be able to let me know if I'm able to create set an iRule on the F5 to set the Content-Type = UTF-8 for all incoming requests? Is it possible to set the content-type at the Header level rather than meta http-equiv? I've been searching and reading for the last few days on the proper syntax to have all request set with UTF-8 by forced iRule however I'm coming up empty if this is possible. Thanks499Views0likes2CommentsModifying http response on iRule corrupts scandinavian characters, how to prevent?
One of our backend applications is returning incorrect hostname for some references on content which leads to timeouts and several minute loadtimes. We've tried to correct the issue by replacing the incorrect hostnames on response data, which works fine except that it corrupts all the scandinavian characters on content. For example the response contents change like this: - "kiinteistönvälitys" becomes "kiinteistönvÀlitys" - "Säästä ja sijoita" becomes "SÀÀstÀ ja sijoita" It seems like any modification to payload corrupts the special characters. If we just take the payload into a variable and do a replace, characters are ok but any change to payload corrupts all the special characters. We've tried following methods on altering the payload, but none of them works properly: - STREAM::expression - STREAM::replace - regsub Any ideas how to get the content replacement done correctly?390Views0likes5CommentsCan we allow UTF 16 Characters in a UTF 8 policy (F5 ASM v12)?
One of the websites uses the "registered" symbol which is 0xC2 0xAE in UTF-8 and 0x00AE in UTF-16. The question is: our policy is set in UTF-8 and when I look at the allowed meta characters options I dont see anything besides the basic !@$%,etc. Is there a way that I can manually add this character or since the policy is set in UTF-8, there is nothing I can do? Thanks.309Views0likes1CommentWhy ASM counts the parameter length incorrectly
Good morning, I have an ASM policy with Unicode (utf-8) as application language. I noticed that ASM multiplys the Arabic characters in the parameters by two. That means if I have a word of 7 Arabic characters It counted 14. This triggers the alarm as the max length of the parameter is 10. I have BIG-IP v11.6.0 Build 4.111.420 Engineering Hotfix HF4. Could it be a bug in this version? Or is just a mistake I did?287Views0likes1Comment