Transitioning Magento 2.4 from Developer to Production Mode Triggers Versioned Static Asset 404s
0 reputation · 22 Dec 2023, 21:53 UTC
When Magento 2.4 is switched from developer mode to production mode, the goal is to have static assets load correctly without manual intervention. In developer mode, static files are served via symlinks from the source directories to pub/static, and the dev/static/sign setting does not affect URL generation. In production mode, enabling dev/static_sign (the default) causes Magento to append a version hash to static asset URLs, expecting the files to exist under pub/static/version*/… after a static content deployment.
The uncertainty lies in the timing and sequencing of the configuration change relative to the deployment step: whether the version hash can be generated without a full deploy, if disabling dev/static_sign in production avoids the 404 while preserving performance, and what the recommended approach is to align the configuration transition with the actual file availability.
Is there a recommended sequence for toggling dev/static_sign and deploying static content when changing modes? Can the version hash be generated independently of a full static content deploy? Does disabling dev/static_sign in production mode resolve the 404 issue without sacrificing caching benefits?