Configure HTML optimization
When you enable HTML optimization, /DCDN automatically removes redundant content, such as comments and extra whitespace, from HTML pages and inline JavaScript and CSS code. This reduces file sizes and improves content delivery efficiency.
Usage notes
-
Do not enable HTML optimization if your origin server uses an MD5 verification mechanism.
When HTML optimization is enabled, /DCDN modifies the file content, which changes the file's MD5 value. This results in an MD5 mismatch with the original file on the origin server.
If your origin server has Gzip compression or Brotli compression enabled, the HTML optimization feature of /DCDN does not take effect. /DCDN passes the compressed files from the origin server directly to the client.
-
If you enable both HTML optimization and a compression feature (Gzip compression or Brotli compression), HTML optimization does not take effect. /DCDN only compresses the files.
-
In some cases, HTML optimization can affect your website's business logic. If clients encounter errors such as
Hydration completed but contains mismatches.when they visit the optimized web page, disable HTML optimization to resolve the issue.
Procedure
-
Log on to the DCDN console.
-
In the left-side navigation pane, click Domain Names.
-
On the Domain Names page, find the target domain name and click Configure.
-
In the left-side navigation tree of the domain name, click Optimization.
In the HTML Beautifier section, turn on HTML Optimization, CSS Optimization, or JavaScript Optimization.
NoteHTML optimization is the master switch for this feature. You must enable it before you can enable CSS optimization or JavaScript optimization.

-
Enable HTML Optimization to optimize HTML pages.
-
Enable CSS Optimization to optimize CSS code.
-
Enable JavaScript Optimization to optimize JavaScript code.
-