CONTAO_ENV variable vs config file for enforcing production mode
0 reputation · 20 Dec 2021, 20:17 UTC
A Contao installation needs consistent mode and path resolution between local development and production. The documented approaches for environment detection are CONTAO_ENV set in the server environment and values persisted in system/config/localconfig.php. Path handling also varies between absolute system/path definitions and relative resolution of var/cache against the document root.
With a subfolder install behind a reverse proxy, baseUrl in routing configuration must align with the proxy prefix, while cache and upload paths are resolved relative to the document root. The interaction of these settings is unclear when the same codebase is deployed across environments with different filesystem layouts and proxy configurations.
Does Contao prioritize CONTAO_ENV over a value stored in system/config/localconfig.php when both are present? When installed in a subfolder, is var/cache resolved relative to the document root or the Contao root, and which documented setting controls that resolution? If baseUrl is defined in routing configuration, does it override automatic base path detection behind a trusted reverse proxy?