Forum Discussion
Modifying 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?
- nitassEmployee
have you tried stream profile (not irule)?
- Sami_126154Nimbostratus
So far all the articles which mention using stream profile basically instruct to active stream profile on virtual server and have an iRule for the actual content manipulation.
Is there some other way or something wrong with our approach?
Our current stream modification rule looks something like this:
when HTTP_REQUEST { STREAM::disable HTTP::header remove "Accept-Encoding" set targethost [string tolower [HTTP::host]] } when HTTP_RESPONSE { switch $targethost { publish.mycompany.com { set wronghost "https://www2.mycompany.com" set correcthost "https://publish.mycompany.com" } ... } if {[HTTP::header value Content-Type] contains "text"}{ STREAM::expression "@$wronghost@$correcthost@" STREAM::enable } }
- nitassEmployee
Is there some other way or something wrong with our approach?
i am not sure but i think i have seen one thread saying stream profile (not irule) works with non-english characters. would you mind trying to put wronghost and correcthost in stream profile?
sol7027: Replacing multiple strings using a Stream profile
- Sami_126154Nimbostratus
That looks promising, I'll give it a try. Thank you.
- Sami_126154Nimbostratus
Works like a charm.
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