Unable to read response from backend when the header is " multipart/mixed; boundary=xxxxxxxxxxxxx " the policy fails with a error " 4006 Error reading Response" in the http routing assertion.
When we try to capture the response with "${response.mainpart}" its a empty value and there is no response body.
The response is a valid multipart we can see the content in postman when sending the request directly to the backend.
Gateway 10.x 11.x
When disabling the gateway multipart handling by adding the following parameter
com.l7tech.common.mime.enableMultipartProcessing=false to the /opt/SecureSpan/Gateway/node/default/etc/conf/system.properties
We can read the response and there is no error logged for the policy but the response content looks like garbage .
The problem in this case was caused by the fact that the multipart response was encrypted using Brotli ,the request was send with a accept-encoding header which contains "gzip,deflate.br".
The response back has a content-encoding set to "br" saying it is a Brotli-compressed response the gateway does not support Brotli compression and treat it as gzip , this corrupt the body
and failed the gateway to read back the response and handle it as multipart which is causing the " 4006 Error reading Response" error.
To prevent the backend to send the response in Brotli , modify the accept-encoding header for the request to contain only "gzip,deflate".
You can use the Manage Transport Properties/Headers assertion to change the accept-encoding header from the incoming request before it is passed to the routing assertion .