I have a client app that send JSON requests to the server pool.
The requests are compressed with GZIP and I’m sending a Content-Encoding: gzip header.
F5 doesn’t seem to uncompress the responses - Policy Builder cannot recognize my JSON data and I get a lot of HTTP compliance errors due to ASM looking at the compressed body instread of uncompressing it.
I couldn’t find anything about uncompressing client requests (just an old, unanswered post from 2009). What am I missing? How can I configure ASM (or LTM) to uncompress the data before the policy is enforced?
Sorry but it’s not clear what is being compressed (or not) here. Are the requests compressed or the responses? Are the real servers doing the compression? If so, I suspect you’ll need to offload that task to the F5 which is no bad thing.
Have you configured a JSON Content Profile and applied it to a Parameter/URL in the ASM policy? Think this only applies to v11, however. I wonder if this would help at all.
Yeah - configured a JSON profile manually and applied to the URL of the service endpoint - I always get “Malformed JSON”. When viewing the request, I see the compressed binary data.
The JSON is definitley well-formed and passes lint tests.
The only explanation I can see is that ASM is not uncompressing the GZIP in the request. I know it can compress/uncompress responses, but I haven’t seen anywhere where I can configure it to uncompress requests
Without this functionality, I will have to drop gzip compression, which will greatly impact my app’s performance. It seems to defy logic that there isn’t such a functionality…
The CLIENT compresses the REQUESTS sent to the server. right now, I don’t care if the server will decompress or F5 - what I’m interseted in, is to apply my ASM policy (parameters, lengths, signatures, etc.) to the JSON payload coming from the CLIENT in the REQUSET.
The problem is that the policy in ASM is not applied to the content bacause ASM only sees the gzip binary data and not the JSON text.
Here is a sample REQUEST, as logged in ASM (header values modified a bit to protect customer info):
I’m afraid I’m not familiar with ASM but perhaps you can move the compression to the F5? Still, I’ve never seen client request compression in use on LTM but I’d assume it’s supported.
That’s the funny thing - everyone I talked to also says that they “assume it’s supported” or that they’re sure it’s “supposed to be an option on the profile”, but nobody can tell where to configure it…
It seems almost trivial that there should be such an option, but where is it?
Hmmm. I’ve trawled through all the F5 docs I can find and there’s just no mention. I’ve also given RFCC2616 a once over and there’s no mention of request compression that I can see I’m afraid.
I was just wondering, I knew Apache supported compressed requests through mod_deflate but didn’t know of any others, now I do. Anyway, it seems like there’s no happy ending for this one unfortunately.
I’ve just been browsing the iRules wiki and it would seem request compression is supported in v11, as indicated by the COMPRESS:: enable ‘request’ subcommand: DevCentral - An F5 Technical Community. No real detail on how it works but I’m sure it could be tested quite easily.
As far as I know the LTM will pass-through compression headers and compressed content unless you have an http-compression profile attached to your virtual. My F5’s have enough to do without adding uncompression to their load, and, more importantly, compression seems to break chunking with some HTTP client libraries, so I have never used a http-compression profile.
There is an iRule DECOMPRESS::enable request that will accomplish this goal. I opened a support case and the engineer gave me a solution. I tested it with an LTM policy or here is the iRule:
when HTTP_REQUEST {
log local0. "**HTTP Request Received**"
if { [HTTP::header "Content-Encoding"] contains "gzip"} {
DECOMPRESS::enable request
log local0. "Content-Encoding is GZIP, DECOMPRESS"
}
}
Hi Walter please can you help me because I have used your code but it seems that it doesn’t work for my web app? How can I use it? How did you verify that content of your request is uncompressed?
I’m not sure, it worked for me. I don’t know what setup you have to steer you in the correct direction. Can you dump out some of your virtual server configuration?