fix: enable mod_headers and mod_expires Apache modules by default#244
Merged
AaronFeledy merged 3 commits intomainfrom Mar 8, 2026
Merged
fix: enable mod_headers and mod_expires Apache modules by default#244AaronFeledy merged 3 commits intomainfrom
AaronFeledy merged 3 commits intomainfrom
Conversation
Adds .htaccess to 8.4 example that sets a custom header via mod_headers and enables mod_expires. Both tests expected to fail since the php-apache startup command only runs 'a2enmod rewrite'. Refs: lando/lando#976, #243
✅ Deploy Preview for lando-php ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The php-apache startup command only enabled mod_rewrite. This meant mod_headers and mod_expires were available in the Debian image but never activated, causing silent failures for .htaccess directives that depend on them (CORS headers, caching, security headers). This affects every recipe using via: apache (Drupal, WordPress, Laravel, Backdrop, etc). Closes #243 Refs: lando/lando#976
This was referenced Mar 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Enables
mod_headersandmod_expiresApache modules by default for all php-apache services.The problem
The php plugin's Apache startup command only enabled
mod_rewrite:sh -c 'a2enmod rewrite && apache2-foreground'Neither
mod_headersnormod_expireswere activated, even though they're available in the Debian php-apache image. This caused silent failures —.htaccessdirectives wrapped in<IfModule>guards (like Drupal's own.htaccess) would simply do nothing.This affects every recipe that uses
via: apache: Drupal, WordPress, Laravel, Backdrop, Joomla, Symfony, etc.The fix
sh -c 'a2enmod rewrite headers expires && apache2-foreground'Changes
builders/php.js: Addedheadersandexpiresto thea2enmodcommandCHANGELOG.md: Added entry for the fixexamples/8.4/.htaccess: Test fixture that setsX-Lando-Test: blazesheader and enables expiresexamples/8.4/README.md: Verification commands that curl for those response headersRelated
Note
Medium Risk
Changes the default Apache module set for all
via: apachePHP services, which can alter runtime header/caching behavior for apps with existing.htaccessrules. Low implementation complexity, but broad impact across recipes using Apache.Overview
Apache-based PHP services now start with
mod_headersandmod_expiresenabled by default by extending thea2enmodstartup command inbuilders/php.js.Adds an
examples/8.4/.htaccessfixture plus README curl checks to verify the modules are active, and records the behavior change inCHANGELOG.md.Written by Cursor Bugbot for commit cedbfb5. This will update automatically on new commits. Configure here.