Monday, June 17, 2013

Configure WSO2 API Manager to send responses to a client which does not support chunk transfer encoding

Some client applications which used the API Manager to invoke APIs may not support chunk transfer encoding and some client applications may need Content-length HTTP header for their application usage. Since by default API Manager gateway sends the response with chunk transfer encoding in either case aforementioned you need to disable the chunk transfer encoding in the response. In this post I am going to show you how to do that.
When creating an API, API Manager will automatically crate a proxy for it in the API gateway which accept the requests on behalf of the actual API. The configuration of that proxy can be found in $CARBON_HOME/repository/deployment/server/synapse-configs/default/api/${PUBLISHER}--${API_NAME}_v${API_VERSION}.xml. In my example I used a API named MovieAPI and version 1.0.0 which published by the publisher eranda and my proxy configuration file is $CARBON_HOME/repository/deployment/server/synapse-configs/default/api/eranda--MovieAPI_v1.0.0.xml
If you check the configuration you will see a configuration which similar to a ESB proxy configuration. So to make it disable the chunk transfer encoding you need to add it to the out sequence as in the following configuration.
        
            
            
            
        
Additionally if your backend API does not support chunk encoding you need to add aforementioned two additional properties to the inSequence.

1 comment:

  1. How do you do this type of thing in a permanent fashion? When I next edit anything about the API in the API Manger it overwrites any changes that have been made in the proxy configuration file.

    ReplyDelete