Forum Discussion

Sami_126154's avatar
Sami_126154
Icon for Nimbostratus rankNimbostratus
Dec 20, 2013

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?

 

  • 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
        }
    }