Anyway another site I have running off same IIS is gzipping correctly (which proves dynamic content compression is enabled in Windows). Also the main site assets are coming down gzipped - just custom api content (application/json) is not.
I have tried various permutations of the Umbraco settings in web.config to no avail:
Found an answer to this, so will leave it here for future reference.
Something to consider when enabling compression in IIS via the applicationHost.config file.
Use the IIS config manager to make the changes or notepad.exe to edit the file. I was using Notepad++ and even though the file was saving, it actually was not.
Something to do with 32/64bit environments, configs and the programs that edit them. Ruined my afternoon!!
But maybe a better question is why they chose to override the defaults for the backoffice. Seems like a lot of content there like angular views and controllers would be better suited as compressed by default
I believe I got it working by adding an additional location element for the API pathway. This keeps compression off for the backoffice, but enables it for your custom API controllers.
Oddly enough, if I set dynamicCompressionBeforeCache to true for the umbraco/api path, gzip compression does not happen.
I do wish some Umbraco guru would chime in on this though and confirm if this is a good enough approach. Seems like a lot of people run into this issue, but there's not a whole lot in the way of a solution.
Cannot get API responses to gzip
How do we get Umbraco to honour gzip response directives?
Nothing I do seems to make a difference.
IIS 10 by default enables it. The is my applicationHost.config snippet (its the default in IIS10):
Anyway another site I have running off same IIS is gzipping correctly (which proves dynamic content compression is enabled in Windows). Also the main site assets are coming down gzipped - just custom api content (application/json) is not.
I have tried various permutations of the Umbraco settings in web.config to no avail:
Any ideas anyone please?
Found an answer to this, so will leave it here for future reference.
Something to consider when enabling compression in IIS via the
applicationHost.config
file.Use the IIS config manager to make the changes or
notepad.exe
to edit the file. I was usingNotepad++
and even though the file was saving, it actually was not.Something to do with 32/64bit environments, configs and the programs that edit them. Ruined my afternoon!!
Seems like it might be a good idea to have
But maybe a better question is why they chose to override the defaults for the backoffice. Seems like a lot of content there like angular views and controllers would be better suited as compressed by default
Did you get this to work. Can't get compression to work for the umbraco/api location, unless I remove the location path="umbraco" from web.config
I believe I got it working by adding an additional
location
element for the API pathway. This keeps compression off for the backoffice, but enables it for your custom API controllers.Oddly enough, if I set
dynamicCompressionBeforeCache
totrue
for theumbraco/api
path, gzip compression does not happen.I do wish some Umbraco guru would chime in on this though and confirm if this is a good enough approach. Seems like a lot of people run into this issue, but there's not a whole lot in the way of a solution.
is working on a reply...