ORIGINAL TITLE: http.response.debug_cacheability_headers TRUE could cause a WSOD - AH01070: Error parsing script headers
I was getting a WSOD with apache 2.4.29_1 and php-fpm 7.1.14 with the following error:
Premature end of script headers: index.php
AH01070: Error parsing script headers
This was happening on a single URL /node/add/XXX of a CT. The rest worked just fine.
I was finally able to sort it out by setting http.response.debug_cacheability_headers to FALSE on development.services.yml.
I then found out this was also mentioned here on #2827047-15: Add http.response.debug_cacheability_headers: true to development.services.yml.
According to @mpotter on #2827047-16: Add http.response.debug_cacheability_headers: true to development.services.yml:
It is actually very common on complex sites to exceed the Apache header size with too many cache tags, especially when logged in as a user looking at a listing page with lots of nodes that are cached per-user because of node-history.
My site is not that complex. It does use paragraphs and a bunch of fields.
Further research pointed me to http://httpd.apache.org/docs/2.4/mod/core.html#limitrequestfieldsize
However, attempting to set any of the following to a grater number didn't help (en either main apache conf and vhost conf)
- LimitRequestFields 100
- LimitRequestFieldSize 8190
- LimitRequestLine 8190
The values above are the default, I increased them with different values, I couldn't make it work. I am not sure if I was doing something wrong or anything but it simply didn't allow me to still access the site on that URL.
I can confirm the cache tag length was 8287 bytes on my particular use case.
Comments
Comment #2
hanoiiComment #3
hanoiiComment #4
hanoiiComment #5
hanoiiComment #6
hanoiiComment #7
liampower commentedI stumbled across this error today as well for a specific content type (add/edit).
Whereas setting
to false in development.services.yml does allow the page to load, it doesn't fix the underlying issue.
Comment #8
wim leersCan you explain why you think this is a bug in Drupal?
Comment #9
hanoiiWell, it's definitely not a bug in Drupal, but, it comes as default on development.services.yml, so it has the potential to fail and it something that I took quite a bit to find the culprit, so maybe document it better even on the yml file, change the default to false?
Comment #10
wim leersIf you don't notice this problem while developing, what happens if you deploy to production on sites that are using e.g. https://www.drupal.org/project/purge or https://www.drupal.org/project/fastly?
Comment #11
hanoiiI am not sure I understand your last comment @Wim Leers. Maybe the summary is not clear, but this IS a potential problem ONLY while developing, and it's related to a default limit in apache. It's just the length of the cache tags header, that it could be too big.
EDIT: Well, it could happen on proudction if you enable the debug headers for some reason,
Comment #12
hanoiiAlso I don't see how this relates to the other modules.
Comment #14
josephdpurcell commentedI ran into this issue on Drupal 8.5.5 inside of https://www.drupalvm.com/, default Apache 2.4.18 settings. The issue occurs when docroot/sites/development.services.yml has http.response.debug_cacheability_headers to "true". I confirmed that even with advagg module uninstalled this setting will cause WOSD.
Here is the error I saw in apache error log:
The solution for me was to change http.response.debug_cacheability_headers to "false".
Comment #15
tanmaykEncountered this with 8.5.6. Fixed after setting
http.response.debug_cacheability_headerstofalse.Comment #16
andres.torres commentedI'm experiencing the same issue which is breaking Pound proxy (v. 2.7). Setting http.response.debug_cacheability_headers to FALSE fixes the WSOD. Drupal core 8.6.1.
Comment #17
cgmonroe commentedI hit this problem as well when re-syncing my development site to the current production site.
It is a Drupal bug because Drupal code produces a header that breaks Apache's rules. The code to produce this tag should not create a tag greater then the standard Apache limit. Instead it should break them up to multiple X-Drupal-.. tags.
The current code simply implodes the list of cache and context tags without checking it's length. The code should do something like the psuedo code below for both X-Drupal-Cache-Tags and X-Drupal-Cache-Contexts tags.
Comment #18
cgmonroe commentedUpdated the title to indicate bug.
Changed category to bug since Drupal is causing the WSOD
Changed Status to active since there is a proposed strategy for fixing this.
Comment #19
remram commentedWe are running to the same error as #14 We are wondering if someone knows the progress about this bug. Does Drupal follow this bug or not? Thank you guys, for further information.
We are using Apache 2.4.29-1ubuntu4.5 and PHP php-fpm 7.2.10-0ubuntu0.18.04.1
Comment #20
cilefen commentedYes. This is the Drupal issue queue.
Comment #22
vaza18 commentedComment #23
vaza18 commentedComment #24
vaza18 commentedComment #25
mpotter commented8000 should not be hard coded. At least needs a constant (for both places it is used)
Comment #26
michaellenahan commentedComment #27
mr.baileysThis issue seems to be a duplicate of #2844620: Automatically split cache debug headers into multiple lines when they exceed 8k. Since that issue is older, I'm closing this one in favor of the older one.
The hardcoding of the maximum length is discussed in that issue, as well as a possible solution to dynamically determine the max header size.
Comment #28
jedgar1mx commentedThanks @michaellenahan the patch fixed my issue. If this issues is getting close, the patch probably should get added to the older issue.
Comment #29
michaellenahan commentedCredit belongs to vaza18 for a very elegant solution. I simply added some boilerplate code. It would be nice to get this resolved, this issue has caused a lot of unnecessary pain for developers.
Comment #30
merryfreespace commentedThanks @michaellenahan, the patch fixed the issue.
Comment #31
ifrikThanks so much michaellenahan
that saved my day after hours of dealing with a server with restricted access and useless logs. And then applying this patch and hours of agony came to an end....
Comment #32
司南 commentedGot this pain in drupal 8.9.7 dev mode, the solution was `drupal smo prod`.
Comment #33
司南 commentedComment #34
miedward commentedUpdate for patch in #21 against 9.2.x since I'm still using it
Comment #35
richirm77 commentedThe same bug reported in ASF Bugzilla:
https://bz.apache.org/bugzilla/show_bug.cgi?id=64919
I have not found if this is fixed by Apache.
Comment #36
miedward commentedUpdate of the previous patch for 9.3.x
Comment #37
anybodyThis has been closed as duplicate, proceed here please: #2844620: Automatically split cache debug headers into multiple lines when they exceed 8k
Comment #38
akz commentedUntil the fix is merged into core, here is a re-rolled version of patch#36 that uses the sorted cache tags prior to splitting. Also note that this patch is applicable for Drupal 10.4.x as well.
Comment #39
akz commentedAlternatively, contrib module Debug Cacheability Headers Split to overcome this issue.