GZip Compression for Website with Ajax |
Hi everyone,
i would like to enable gzip-compression for my website. But than i have a problem with my ajax-requests. E.g i run into js error (because i get a compressed json). I guess i cant handle this with jQuery, so is it possible to disable the gzip compression for some controller-functions? Eg. Controller/func1 = compression on Controller/func2 = compression off Thank you ! ![]() //Im not sure if "Best Practices" or "General Help" is the correct section for this.
What do you mean by "i run into js error (because i get a compressed json)"?
Json should remain valid even if compressed. Could you provide an example of what a request looks like compressed (invalid) and uncompressed (valid), as well as your javascript code which can't parse the compressed code.
Try this:
1. Open php.ini 2. Add zlib.output_compression=On 3. Save 4. Reset server (if needed) (04-20-2017, 11:04 AM)antony Wrote: What do you mean by "i run into js error (because i get a compressed json)"?If "compress_output" = false, than i get a valid json back. If "compress_output" = true, i dont get any data back from the api. (But get 200 OK from Server) @Diederik Thank you, that work. @AzrielOmega Mhh that didnt effect the loading-size of my page...
Enabling compression should not break AJAX responses. Did you check your error log?
compression can sometime break functionality particularly ajax therefore take proper care when applying gzip.
|
Welcome Guest, Not a member yet? Register Sign In |