Date Published: March 4, 2022
Troubleshooting "Cannot modify header information - headers already sent" Errors
Issue¶
Single Sign-On (SSO) may suddenly stop working, and errors in the logs like this may appear:
Warning: Cannot modify header information - headers already sent by (output started at /mnt/www/html/example/vendor/symfony/http-foundation/Response.php:377) in Drupal\simplesamlphp_auth\Controller\SimplesamlphpAuthController->authenticate() (line 197 of /mnt/www/html/example/docroot/modules/contrib/simplesamlphp_auth/src/Controller/SimplesamlphpAuthController.php)
Resolution¶
If you're encountering this on all of your environments, then it's possibly related to code, specifically a module you might have enabled recently. Though the above is specific to SimpleSAML, a post on Drupal's Stack Exchange for troubleshooting an issue like this in general recommends disabling/uninstalling the most recently installed modules until you can isolate which module is at play. Even if it seems unlikely that a module is at play, disable it to at least rule it out as a cause. If you're able to re-enable the modules you absolutely need and logging in works, then do the same thing in the production environment.
The SimpleSAML project on Drupal.org has an issue discussing the order in which headers are sent to the client, with patches that propose to address the issue. Try that if the disabling/re-enabling modules approach doesn't work.
Did not find what you were looking for?
If this content did not answer your questions, try searching or contacting our support team for further assistance.