Expand my Community achievements bar.

Commerce Cloud htaccess configuration (for HTTP text compression)

Avatar

Level 1

Hello, I'm trying to configure text compression within Adobe commerce cloud.
I see many topics online that suggest the way to this in commerce (magento2) is to enable text compression on the apache server via the .htaccess file.
I understand that you cannot edit this file directly on the commerce cloud platform, can anyone explain how I am supposed to make the changes required to enable text compression?

 

Is it possible to add some configuration via the magento.app.yaml configuration file?

 

I don't see any information at all about this really on the adobe documentation, other than this: Web property | Adobe Commerce but it looks very limiting as to what you can add.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Level 7

Enabling text compression in Adobe Commerce Cloud can indeed be a bit tricky, as direct access to the .htaccess file is not allowed for security and stability reasons. However, there are alternative ways to achieve this:

  1. Magento.app.yaml: This file is used to configure your application’s settings. You can add custom environment variables, specify the PHP version, configure cron jobs, and more. However, it doesn’t directly support enabling text compression.

  2. Custom Module: You can create a custom module that adds the necessary headers to enable text compression. This module would use an observer or plugin to listen for the appropriate event (like controller_action_predispatch), and then add the Content-Encoding: gzip header.

  3. Server Configuration: Adobe Commerce Cloud uses Fastly as its Content Delivery Network (CDN), and Fastly supports gzip compression by default. If you’re not seeing compressed responses, you might need to check your Fastly settings.