I build a plugin that in the end change the response headers + body and even statusCode.
I’m trying to send request throw postman and I’m getting the error incorrect header check,
but if I send curl request I get the response I needed.
anyone know what can it be?
Hey! Thanks for bringing this from Gitter to the forum.
So the response works as expected when requesting via
curl but not via Postman? That indicates the requests are not identical, or your response is formatted in a way that Postman fails to parse but
curl lets it pass.
It seems “incorrect header check” errors in Postman have to do with Zlib compression. Perhaps you are setting gzip Content-Encoding but not actually gzipping the data?
We are encountering the same issue.
Our scenario is as follows:
- We have a custom response mapping plugin (similar to the response-transformer provided by kong) - with priority 900.
- When requests are modified using this plugin we get “incorrect header check” using postman. We noticed that the postman requests contains header: “Accept-Encoding:gzip, deflate” by default.
- When we override this header with “Accept-Encoding:’’” (empty value) the response works as expected.
- When we send the same request using curl - it works.
- When calling other endpoints which do not trigger the response mapping plugin - it works.
Our assumption is, that since postman requests “Accept-Encoding:gzip,deflate”, it expects the response to be compressed, but it doesn’t get compressed when the response is changed in our response mapping plugin (which is written very similarly to the kong response transformer).
The response compression should be handled in nginx scope as we understand, so do you have an idea why it doesn’t get compressed if we modify the response?
Look at the following issue:
We followed its solution and it did the trick for us:
proxy_set_header Accept-Encoding “”; (location / section)
gzip_types text/plain application/json; (server section)