KB Article #188620

Resolving the Issue of Missing "Content-Transfer-Encoding" Headers in Multipart Messages

Problem

By default, API Gateway removes the "Content-Transfer-Encoding" (CTE) header from multipart messages during processing.

While this default behavior is acceptable for many use cases, it can cause issues when dealing with clients, such as .NET, that rely on the presence of the "Content-Transfer-Encoding" header for proper message transmission and decoding. In particular, the removal of this header affects multipart messages where different parts may need specific encoding types, such as "8bit" or "binary".

Resolution

The removal of the "Content-Transfer-Encoding" header by default is an optimization strategy aimed at reducing unnecessary message overhead in specific scenarios, particularly in SOAP MTOM. However, the logic is careful to preserve the CTE header when it is necessary for the correct transmission or integrity of the message, such as in signed messages or when handling multipart/related MIME messages containing XOP elements.


To prevent the "Content-Transfer-Encoding" header from being removed during the transformation, you must set the KEEP_CTE environment variable. This will ensure that the header is preserved in both parts of the multipart response.


The environment variable can be set by running the following command in the shell:

export KEEP_CTE=1


To make this change permanent, you can add the KEEP_CTE=1 line to your shell profile file (e.g., ~/.bashrc, ~/.bash_profile, or equivalent file for your shell).


Note: API Gateway processes will have to be restarted to ensure the environment variable is applied.