Forum Discussion

David_Michael_1's avatar
David_Michael_1
Icon for Nimbostratus rankNimbostratus
Nov 07, 2014

SVG files not being compressed

I am attempting to enable http compression for svg images. I have added the content-type image/svg+xml to the compression content-list but when I do a curl command with -H 'Accept-Encoding: gzip,deflate' I still do not get back a content-encoding gzip header. However, it is working correctly for other types like js and css. Am I missing something here?

 

  • The plus sign is probably causing an issue.

    Try entering this (assuming you are using the GUI):

    "image/svg+xml"

    I say this as the default mimetype application/(xml|x-javascript) is listed in the configuration file as

    "application/(xml|x-javascript)"
    - with double quotes.

    • George_Efimoff_'s avatar
      George_Efimoff_
      Icon for Nimbostratus rankNimbostratus

      Hi! Apologies for bringing up the topic again, but could you kindly publish the specific example of proper escaping which works 100%, please? I tried various things, none worked, i.e. image/svg\x2Bxml, image/, image/svg

       

    • George_Efimoff_'s avatar
      George_Efimoff_
      Icon for Nimbostratus rankNimbostratus

      Hi Jie!

       

      Unfortunately it did not work. Following I found not working as well: image/svg+xml ^image/.* or, even image/

       

      Thanks a lot for your help!

       

  • Finally, with F5's help, made it work. It looks like + sign, even quoted, complicates the things. So, working content entry, in the end, was image/svg and noting else with svg in the list. In my case:

     

    content-type-exclude { image/gif image/jpeg image/png } content-type-include { text/ "application/(xml|x-javascript|javascript)" image/svg font/woff2 image/ }