curl command a gzipped POST body to an apache server

The thing is that mod_deflate does not like the gzip header shown here:

hexdump -C body.gz
00000000  1f 8b 08 08 20 08 30 59  00 03 62 6f 64 79 00 ab  |.... .0Y..body..|
00000010  56 50 ca ad 4c 29 cd cd  ad 54 52 b0 52 50 ca 2a  |VP..L)...TR.RP.*|
00000020  ce cf 53 52 a8 e5 02 00  a6 6a 24 99 17 00 00 00  |..SR.....j$.....|
00000030

The solution is simply to give it to gzip without the intermediate file step, if taking a stream, it will not print the headers and apache will like the body!

echo '{ "mydummy" : "json" }' | gzip > body.gz
curl -v -i http://localhost/mymodule -H'Content-Encoding: gzip' --data-binary @body.gz

This works, the apache module receives the decompressed bytes.

You can see the header difference here, you no longer see the file name (body) in the gzip file:

hexdump -C body.gz
00000000  1f 8b 08 00 08 0a 30 59  00 03 ab 56 50 ca ad 4c  |......0Y...VP..L|
00000010  29 cd cd ad 54 52 b0 52  50 ca 2a ce cf 53 52 a8  |)...TR.RP.*..SR.|
00000020  e5 02 00 a6 6a 24 99 17  00 00 00                 |....j$.....|
0000002b

Single line:

echo '{"mydummy": "json"}' | gzip | curl -v -i --data-binary @- -H "Content-Encoding: gzip" http://localhost/mymodule