Curl returns JSON but Gateway Policy returns binary data with header accept-encoding including br
search cancel

Curl returns JSON but Gateway Policy returns binary data with header accept-encoding including br

book

Article ID: 218388

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

Creating a passthrough Policy to invoke third party API. Using Postman API returns  valid JSON  but thru Gateway it is returning binary (junk).

I have just Route via HTTPS assertion. And for testing purposes, did not change anything in assertion except the API url.

In service debugger you can observe request headers,

"accept-encoding:gzip, deflate, br"

Environment

Release : 9.4

Component : API GATEWAY

Resolution

The gateway doesnt support br (brotli) encoding.

Can you add to your policy add/remove headers (or modify transport headers).

On the Request before its routed (route via http(s)).

Remove the accept-encoding.

"accept-encoding:gzip, deflate, br"

And add  accept-encoding back as,

"accept-encoding:gzip, deflate"

 

This will remove the ability to encode using br (from the back-end). And allow the gateway to correctly parse the response to the end client.