Unable to process gzipped payload

Product/components used and version/fix level:

API Gateway

Detailed explanation of the problem:

When I am sending a request from client, which contains a gzipped file as data and content-encoding header as gzip, the request payload is being decoded by API-GW in authentication mode (Identify and Access → Custom Extension) and sent as raw data in the request received by endpoint server for authentication. With this we are able to process the request payload.

However, when authentication is not enabled and we are sending the request payload as part of the logs (Traffic Monitoring → Log Invocation → Store Request Payload) we are receiving a string in requestlog which gzip APIs are unable to decode and give an error “gzip: invalid header”. Compress Payload Data is set to False.
Sample payload received in logs:

“reqPayload”:“\u001F�\b\b6�}d\u0000\u0003test.txt\u0000�VH,…�/JQ�R��K-�HM�QtPV�QPJ�L�I1\u0004J$&%��F@~n^�R-\u0017\u0000�i>2<\u0000\u0000\u0000”

Error messages / full error message screenshot / log file:

Wireshark Screenshot:

Question related to a free trial, or to a production (customer) instance?

Yes, I downloaded the 10.15 free trial docker image for our evaluation.

1 Like

Please Use below code snippet to extract the payload

public static void main(String[] args)  throws IOException {
        String zippedBase64Str = "H4sIAAAAAAAAAKtWKkotLE0tLgkN8lGyUtLPzCvLz07Vd81Lzk/JzEsPAcroFacWlWUmpxZbFaUmp2aWpQZBdOg7R3jFeVYr1QIAJt1fN0QAAAA=";
        String unCompressedPayload = "";
        byte[] bytes = Base64.getDecoder().decode(zippedBase64Str);
        GZIPInputStream zi = null;
        try{
            zi = new GZIPInputStream(new ByteArrayInputStream(bytes));
            unCompressedPayload = IOUtils.toString(zi);
        }finally{
            IOUtils.closeQuietly(zi);
        }
        System.out.println("unCompressedPayload - "+unCompressedPayload);
    }
1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.