While invoking backend REST service we receive below error.
{"fault":{"faultstring":"Unsupported Encoding \"UTF-8\"","detail":{"errorcode":"protocol.http.UnsupportedEncoding"}}}
Similar question was asked in below but we have no control on the response.
https://community.apigee.com/questions/30479/how-to-fix-unsupported-encoding-utf-8-error.html
How to resolve it?
-Vinay
Below is the debug trace...Please share your thoughts as how can we resolve this issue.
com.apigee.errors.http.user.UnsupportedMediaType: Unsupported Encoding "UTF-8"
at com.apigee.protocol.http.msg.Encoding.wrap(Encoding.java:87) ~[http-1.0.0.jar:na]
at com.apigee.protocol.http.msg.Encoding.wrap(Encoding.java:52) ~[http-1.0.0.jar:na]
at com.apigee.protocol.http.HTTPClient$Context$3.onHeaders(HTTPClient.java:1039) ~[http-1.0.0.jar:na]
at com.apigee.protocol.http.io.MessageReader.onRead(MessageReader.java:119) ~[http-1.0.0.jar:na]
at com.apigee.nio.channels.DefaultNIOSupport$DefaultIOChannelHandler.onIO(NIOSupport.java:51) [nio-1.0.0.jar:na]
at com.apigee.nio.handlers.NIOThread.run(NIOThread.java:123) [nio-1.0.0.jar:na]
As expected based on the error message I am able to track the issue via tcpdump as the response from backend having header with
Content-Encoding: UTF-8 which apigee is not appreciating. Can some one detail on what is happening?
As per spec it show as below..
https://tools.ietf.org/html/rfc7231#section-3.1.2.2
==
The "Content-Encoding" header field indicates what content codings
have been applied to the representation, beyond those inherent in the
media type, and thus what decoding mechanisms have to be applied in
order to obtain data in the media type referenced by the Content-Type
header field. Content-Encoding is primarily used to allow a
representation's data to be compressed without losing the identity of
its underlying media type.
==
Below is the headers when the issue occurs. Content-Type and content (json) matches . Wondering what is the issue.
Content-Length: 404
Content-Type: application/json; charset=utf-8
Last-Modified: 2017-09-08T17:10:46.451-06:00
Content-Encoding: UTF-8
Allow: GET, POST, HEAD, PUT, DELETE, OPTIONS
X-Powered-By: Servlet/2.5 JSP/2.1
Answer by vinay · Sep 18, 2017 at 02:35 AM
As per RFC specification ( https://tools.ietf.org/html/rfc2616#section-3.5 ) value UFT-8 should not be present in Content-Encoding header as it is not valid and message-processor behavior is correct.
I'm unable to change in the server, is there any other workaroud.
Reviving old thread.
I am facing this as well ... with the request hitting the backend server and working correctly.
Yet Apigee freaks out due to the incorrect response an returns the 415.
I have not found any override ability, including declaring properties to ignore errors.
Is there perhaps any other override ability ?
I have the same issue: I can send a request directly to the backend but when I proxy with Apigee I get the same error.