Layer 7 API Management

Expand all | Collapse all

GZIP Compress - Weird Characters

Jump to Best Answer
  • 1.  GZIP Compress - Weird Characters

    Posted 04-25-2018 04:24 PM

    In my API Gateway I'm attempting to GZIP Compress a Base64 encoded string. This Base64 encoded string is a JWT that I've generated using the Encode Json Web Token assertion. 

     

    Once I GZIP compress this Base64 encoded string I'm noticing that its appearing as a ton of odd symbols. I thought that this was occurring because of my Base64 encoded string however I'm noticing the same weird characters when I GZIP compress a basic string context variable with a value of "TestTestTest". Does anyone know why this would happen? I'm unable to decompress this compressed value using GZIP decompression because it doesn't appear to be valid GZIP Compressed data. 

     

    Heres what it looks like when I go to GZIP compress a context variable with the value of "TestTestTest"



  • 2.  Re: GZIP Compress - Weird Characters
    Best Answer

    Posted 05-01-2018 09:57 PM

    Dear mrutherford ,

    gzip is in binary format, that's why you see those wired chars.

     

    Regards,

    Mark



  • 3.  Re: GZIP Compress - Weird Characters

    Posted 05-02-2018 02:09 PM

    Thanks for the clarification. Once I GZIP Compress this value I seem to be unable to GZIP Decompress it. I'm receiving an error message saying: Error encoding or decoding: Not in GZIP format.

     

    Any ideas? 



  • 4.  Re: GZIP Compress - Weird Characters

    Posted 05-02-2018 07:53 PM

    May need more details on how you do it to understand what's going on.

    Are the compress, decompress in the same policy, or in different services? You may upload your test policies for review. (it's better to open a support ticket)

    if you pass the gzip payload with header accept-encoding: gzip, it may be decompressed automatically. you can use  the audit detail assertion to check the gzip value before decompress.



  • 5.  Re: GZIP Compress - Weird Characters

    Posted 05-03-2018 10:28 AM

    In my test policy I'm doing the following:

    • Route via HTTP - This assertion is returning a JSON payload that I'm including in the Encode Json Web Token assertion in the following step.
    • Encode Json Web Token: sign payload - Using the Service debugger I can see that the JWT is valid and have verified that it can be Base64 decoded without any issues.
    • GZIP Compress the JWT that was generated
    • GZIP Decompress the JWT that was generated - This assertion fails with the error message "Error encoding or decoding: Not in GZIP format."  

     

    I've used the Audit Detail Assertion and Service Debugger and I can see that the context variable that I use as the Target Variable in the Encode/Decode GZIP Compress assertion is populated with that binary value.