Deprecating Auto Minify

Hi Community –

As some of you have noticed, Cloudflare plans to deprecate the Auto Minify feature on August 5th, 2024. I’m linking this post to an email communication that is about to be sent out. The reasons why we plan to remove the feature are manifold but boil down to the fact that it’s a performance feature used for the purpose of reducing page weight and it is not as efficient at doing this as other projects Cloudflare’s working on, like improving compression.

Please ask questions here and I’ll try to respond or have someone from the team look into it. If there are areas that members of the community can help with, please do so, after all that’s what this channel is for :slight_smile: .

4 Likes

It’s sad to see such an age old feature goes away but I guess if during your testing you have seen that CSS & JS minification (the balanced type done by Cloudflare) is not making much impact then surely this does make sense.

For HTML, 100% not only I have seen it increasing the latency a bit but also causing issues in many cases where site uses custom template tags and things like that.

So, I’m sad to say goodbye to an old friend :frowning: but at the same time exited to see the new things rising up from the horizon. :slight_smile:

3 Likes

thanks for understanding @saumya

2 Likes

I’m very angry it’s being removed. It was my favorite feature. I used it extensively

3 Likes

it should be there whether we use it or not

1 Like

And what about servers (like ours) that use this feature? Not really impressive for a business account holder when several of these features being used are becoming deprecated with no replacement.

Not every deprecation has to carry a replacement, there is hardly any reason to have any CDN do minification or optimizations for you when local compilers will do it more accurately and better.

If you have legacy setups that can’t afford to update files/add dependencies/w.e, take advantage of the minified version now and set the cache to never expire and store it in cache reservation, you can also add a nginx proxy that minifies the files from your origin, etc.

There are plenty of workarounds, all of which I can agree to be tedious, but it is what it is, deprecations happen and I don’t imagine replacing auto minify taking that long, even in obscure and absurdly large setups.

As long as communication is done correctly and customers are aware of the deprecation, there is still plenty of time until August for everybody to take action.

4 Likes

Good day. i received an email from Cloudflare regarding deprecation of Auto Minify. The message includes steps to take, including run a performance test with Auto Minify enabled and then repeat the test with Auto Minify disabled. This step includes a link to How to use Cloudflare Observatory for performance experiments

However, the page at that link does not include any steps to do this performance test with Auto Minify enabled and then disabled. i am not a web developer and would appreciate guidance on hot to do this.

Thanks,
franc

1 Like

Hi Franc,

There are two things to know – how to enable/disable the autominify feature and how to test this change on your website.

There are a few ways to enable or disable Auto Minify on your website.

  1. Cloudflare Dashboard:
  • Sign into your Cloudflare account and select your website.
  • Navigate to the “Speed” section in the left-hand navigation bar.
  • Choose “Optimization” under the “Speed” section.
  • Look for the “Content Optimization” tab where you can enable or disable Auto Minify.
  1. Configuration Rule:
  • You can also enable or disable Auto Minify through a configuration rule found under the “Rules” tab. However, if this is not already configured, I recommend using the method described above.

To understand the impact of Auto Minify on your website’s performance, you can run a synthetic test:

  • Go to the “Observatory” section (under “Speed”) and enter the URL you want to test.
  • Click “Run Test Once” from your selected location to see the performance with Auto Minify enabled and disabled.
  • To understand some of the results of the performance test there is some documentation to get you started here.
  • Alternatively, you can use third-party testing tools like WebPageTest.

I assume Auto Minify is currently enabled, so we should run a performance test before making any changes:

  1. Go to the “Observatory” section and enter the URL you’d like to test.
  2. Click “Run Test Once” from your selected location.
  3. Review the results

After reviewing the results, you can disable Auto Minify for HTML (for example) and rerun the Observatory test to compare the performance differences.

Please let me know if you need any additional information while testing.

2 Likes

Thank you akrivit, for the detailed instructions. i followed the steps and performed several tests with all possible combinations of all three settings (html, css and javascript) enabled and disabled. Here are the results:

All 3 enabled: 91

only html disabled: 91

html and css disable: 91

html, css and javascript disabled: 89

only javasript disabled: 89

only css disabled: 92

javascript and css disabled: 91

javascript and html disabled: 89

Please note that i forgot to purge between tests. Does this render the test results invalid? If not then, it looks like the autominify feature is helping with web site performance and i need to find a replacement for the autominify feature before it is deprecated , correct?

Thanks,

franc

Not every deprecation has to carry a replacement, there is hardly any reason to have any CDN do minification or optimizations for you when local compilers will do it more accurately and better.

I think that makes a lot of assumptions about the web architecture and languages that someone might be using.

It also ignores that Cloudflare caches the files anyways, so it needs to only minify it once and then keep it in its cache for a while.

I have dozens of websites running under a traditional LAMP stack. There is no “local compiler” that processes the CSS or JavaScript. The files get copied onto the web server, and that is that. There’s no build process or anything.

Considering that PHP still remains a highly used language and likely makes up a good fraction of websites proxied through Cloudflare, I imagine this will result in an inferior experience on many websites. As a developer, I am not going to waste time minifying CSS files that change often or manually minifying them whenever I change one - I do that for one main jumbo CSS file I have that’s used on many sites which doesn’t change, and that’s it, otherwise, nothing is minified on the server. That’s what made the Auto Minify feature really nice and convenient - saving developer time, freeing them to do other things. The time still isn’t there, so I guess moving forward some pages will just load slightly slower than before.

Now, for HTML, I actually would agree, since with PHP, it’s fairly straightforward to generate minified HTML without impeding the developer workflow. But I write all my CSS and JS by hand, so they don’t benefit from that additional step.

Not really, at best it would be once per pop assuming the cached is never invalidated, which can occur either to release resources or because the cache expired.
One visitor can be routed through many locations depending on the day/hour to prevent network congestions, so it definitely happens more than once.

Considering the many millions of requests per second cloudflare processes per second, adding one function that parses files in real time is absurdly expensive.

I have dozens of websites running under a traditional LAMP stack. There is no “local compiler” that processes the CSS or JavaScript. The files get copied onto the web server, and that is that. There’s no build process or anything.

If you are working with old code bases on LAMP installations, there is nothing that prevents you from installing plugins on your server to do the optimizations. PageSpeed Module  |  Google for Developers this is likely to be better than what CF offers right now.

Considering that PHP still remains a highly used language and likely makes up a good fraction of websites proxied through Cloudflare, I imagine this will result in an inferior experience on many websites.

This doesn’t make lots of sense, you can use any modern frontend framework with PHP.

As a developer, I am not going to waste time minifying CSS files that change often or manually minifying them whenever I change one - I do that for one main jumbo CSS file I have that’s used on many sites which doesn’t change, and that’s it, otherwise, nothing is minified on the server.

Absolutely, I would never recommend anybody to minify files manually.

That’s what made the Auto Minify feature really nice and convenient - saving developer time, freeing them to do other things

But it takes minutes to implement any of the approaches I mentioned earlier, this is not as complex as it might seem.

But I write all my CSS and JS by hand, so they don’t benefit from that additional step.

Pagespeed or something like that is your best option here

2 Likes

This doesn’t make lots of sense, you can use any modern frontend framework with PHP.

True, but not everyone does. I don’t use any PHP frameworks myself - I have my own libraries of functions that my sites use, but it’s all self-written, and each request executes a PHP script.

Pagespeed or something like that is your best option here

Thanks, that seems interesting and worth taking a look at.

I’m sure the quality of what both Cloudflare and Google are doing is pretty decent. But a nice aspect about Auto Minify is Cloudflare was doing the work, so to speak. With Pagespeed, that’s additional work for the origin server, though probably not a significant amount.

1 Like

Hi Franc, you’ll need to purge for the CSS/JS effect to be understood. I might also look into how the overall score that you posted is changing from the values that compose it (like LCP, etc) that should also be present in the observatory dashboard that you’re looking into.

@akrivit So this feature is “gone” the ui to toggle it off is “gone”
Yet it still seems to take effect on my site after the purge. After purging everything, the first hit does NOT minify, the subsequent hit minifies with cf-bgj: minify header present. This ofc results in an error in core.js

How to turn it off now?

Try using the API.

A GET to this one will show the settings:
https://api.cloudflare.com/client/v4/zones/{{zone_id}}/settings/minify

And a PATCH to the same endpoint can set them with this body:

{
  "value":{
    "css": "off",
    "html": "off",
    "js": "off"
  }
}

https://developers.cloudflare.com/api/operations/zone-settings-edit-single-setting

2 Likes

@akrivit Removing the toggle from the dashboard while still leaving the feature enabled for people is not a great experience.

This has hit the Astro team today too:

When is this going to actually be disabled for folks? Or is there going to be some official documentation provided for how to disable it now?

2 Likes

Thank you for the feedback, @cherryjimbo and @user84715.

I understand that the UI and API change has taken some by surprise, and I appreciate your patience. To provide some context, we’ve initiated the deprecation process for this feature internally and have encountered a few additional complexities along the way. The UI was removed to prevent further activation while we work on fully retiring the backend.

In the meantime, as @sdayman mentioned, you can still manage this via the API. Below is an example to help you disable Auto Minify for your zone:

curl -s 'https://api.cloudflare.com/client/v4/zones/INSERT_ZONE_ID_HERE/settings/minify' -X PATCH -d '{"value":{"css":"off","html":"off","js":"off"}}' --header "Authorization: Bearer INSERT_TOKEN_HERE" --header "Content-Type: application/json"

I’ll work on getting a developer document up by today or tomorrow to help bridge the gap until we complete the deprecation.

Please don’t hesitate to reach out if you encounter any further issues. Thank you again for your understanding and support!

Thanks @akrivit. I would really encourage y’all to restore at least the ability to disable this feature via the dashboard until it’s actually disabled globally.

As people update their frameworks, versions of libraries on their sites, etc. something that was working before might not work at all with Auto Minify enabled, which they now can’t disable without researching what’s happening, knowing it’s Auto Minify, and then finding some undocumented way to disable it.

For especially non-technical users that might experience issues with this, pushing them to use the API to disable something is very bad UX. The UI, in my opinion, should have only been removed at a time when the feature was disabled globally, for everyone.

5 Likes

It’s not just by surprise, this striaght up broke websites without a way to fix quickly. Maybe developer mode?!

what is the permission for the token required to patch?