Enable text compression in AEM | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

5 replies

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 25, 2023

Can you elaborate on what type of compression you are referring to?

I guess you are referring to dispatcher compression, if so, you could use the DEFLATE mod, please take a look at these resources that will guide how to enable this:

 

https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#specifying-the-documents-to-cache
https://www.albinsblog.com/2018/09/improve-performance-of-adobe-experience.html

Esteban Bustamante
Ravi_Pampana
Community Advisor
Community Advisor
September 26, 2023

Hi,

 

By default, AEM does not compress JSON files. To enable compression for JSON you can add below in dispatcher.any file

/filter{
/0001
{
/glob "*.json"
/type "allow"
/name "Allow JSON"
/action "gzip"
}
}

After making changes to the Dispatcher configuration, restart the Apache web server to apply the new rules.

September 26, 2023

Hi @ravi_pampana ,

can it be applicable for AEM as Cloud Service.

kautuk_sahni
Community Manager
Community Manager
September 26, 2023

@rajesh_didshe Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni
September 27, 2023

Hi @kautuk_sahni ,

 

I have tried above both step as @ravi_pampana  and @estebanbustamante mentioned. Tried DEFLATE mod but it's not working and for Filter step getting build failure error on action and name. Have attached Screenshot of build error log for same.

kautuk_sahni
Community Manager
Community Manager
September 28, 2023

To enable text compression using OSGi config and dispatcher rules for JSON files in AEM, you can follow these steps:

  1. Enable text compression in AEM.

    • Go to the AEM Configuration Manager.
    • Navigate to OSGi > Configurations > Apache Sling Dispatcher.
    • Edit the filter configuration.
    • Add the following filter rule:
    JSON
    {
        "glob": "*.json",
        "type": "allow",
        "name": "Allow JSON",
        "action": "gzip"
    }
    
    • Save the configuration.
  2. Configure the Dispatcher.

    • Edit the dispatcher.any file.
    • Add the following filter rule:
    JSON
    /filter {
        /0001 {
            /glob "*.json"
            /type "allow"
            /name "Allow JSON"
            /action "gzip"
        }
    }
    
    • Save the file.
  3. Restart the Dispatcher.

Once you have completed these steps, text compression will be enabled for JSON files in AEM.

Note: If you are using AEM as a Cloud Service, you cannot edit the dispatcher.any file directly. Instead, you must use the Dispatcher configuration UI. To do this, go to the Dispatcher section of the Cloud Manager and click Edit Configuration. Then, add the filter rule.

Kautuk Sahni
kautuk_sahni
Community Manager
Community Manager
September 28, 2023
kautuk_sahni
Community Manager
Community Manager
October 4, 2023

@rajesh_didshe Were you able to succeed? 

Kautuk Sahni
October 7, 2023

 @kautuk_sahni 

dispatcher.any file is immutable, So tried above step in filter.any file but getting build error for action.