Forum Discussion

1_21GigaWatts_2's avatar
1_21GigaWatts_2
Icon for Nimbostratus rankNimbostratus
Oct 16, 2015

Set 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.

 

Thanks

 

2 Replies

  • At a minimum, something like this to update the incoming Content-Type header:

    when HTTP_REQUEST {
        if { ( [HTTP::header exists Content-Type] ) and not ( [string tolower [HTTP::header Content-Type]] contains "charset=utf-8" ) } {
            HTTP::header replace Content-Type "[HTTP::header Content-Type]; charset=utf-8"      
        }
    }