- Issue created by @frondeau
There are assets system changes in Drupal 10. Did you have an opportunity to review the release notes?
- π«π·France frondeau Nantes, FRANCE
Hello @Cilefen,
Thank you for your feedback.
Which pages would reply to my issue, please, ?
Would you post the concerned urls ?
Thank you by advance,
Regards; I donβt remember ever having seen it with Drupal. See also https://stackoverflow.com/questions/58215104/whats-the-neterr-http2-prot...
- π«π·France troesler
I have the same problem with OVH :
- PHP 8.1
- Mysql
- https
- Drupal 10.2.2 fresh install.
Here is my test url : https://drupal1022.monsitedev.com
You may see the error on Chrome on the front page
I spended hours of researches and tests in vain, so if a kind soul is willing to solve this problem, I will be forever grateful! - π«π·France mably
Same problem here, Drupal 10.2.2 on PHP 8.1.
Is any solution available?
There is a lot of debugging advice in https://stackoverflow.com/questions/58215104/whats-the-neterr-http2-prot.... If you havenβt done those things you havenβt done everything.
- π«π·France mably
It looks like Drupal sends an invalid "content-length" header for JS and CSS gzipped assets on first load.
- π¬π§United Kingdom longwave UK
@mably if you can reliably reproduce that with a set of steps that would be really helpful, as we can turn it into a test case.
- π«π·France frondeau Nantes, FRANCE
Hello all,
Thank you for your feed backs, I fell less alone ;-)
I can confirm that there is a difference between D9 and D10.2.2 as there is a Content-Length in the header, reporting the file size.
It' seems that in my case, the docment has a size of 32KB.
All the other files are loaded from memory (0KB) or heavy less equals 5.5KB.
Is Content-Length usefull ?
If so, what would happen if the code set it to -1?
Thanks by advance. - π¬π§United Kingdom longwave UK
Content-Length was added to fix other issues: https://www.drupal.org/node/3298551 β
However perhaps this is now incorrectly calculated in the case of gzipped content?
- π«π·France frondeau Nantes, FRANCE
@Cilefen,
About the link you're sharing, https://stackoverflow.com/questions/58215104/whats-the-neterr-http2-protocol-error-about, many answers are talking about the environment size and the cpu, but in my case, the website is about 2% of the disk size, and the memory is not full used neither.
As the error message is about HTTP/2, it seems to be due to the protocol, so maybe the answer would be about the header, woudn't it ? - π«π·France frondeau Nantes, FRANCE
Thank you for your feedback @longwave, I guess the subject is Content-Length too.
@frondeau
Wrong content-length header is mentioned a lot at https://stackoverflow.com/questions/58215104/whats-the-neterr-http2-prot.... There are many possible answers.
- π¬π§United Kingdom catch
I've opened an MR with a potential fix - to just stop adding the content length header for BinaryFileResponse (which is what the first asset request returns). Would be great if people experiencing this issue on OVH could try it out (at least once we've had a green test run here). We should probably add some minimum test coverage to the existing content length tests to make sure files are skipped too.
Can you confirm that asset aggregates are actually getting written and this problem is only for the first request that builds them? After that they should be served as actual files and would expect it to work again.
If the server gzips the response from Drupal, it should also be responsible for updating the content length header, so this is perhaps mis-configuration on OVH's side? But also don't feel that we have a strong use case for setting the content length header for binary files and if we can save people hours/days of fruitless debugging that would be good.
- π«π·France mably
The proposed fix doesn't seem to work on my side.
Looks like we never go through the related code when generating aggregated CSS and JS.
But may be I'm doing something wrong. - π«π·France frondeau Nantes, FRANCE
Hi @catch,
Thank you for your MR.
I can't test this MR as it is pull from 11.x.
But I could test if you create a MR on 10.2.2, on a real website.
Would you have any time to repeat it on this version, please ?
Thank you by advance. - π¬π§United Kingdom catch
@frondeau you should be able to use the diff from https://git.drupalcode.org/project/drupal/-/merge_requests/6453.diff to a 10.2.x site, the affected code is identical.
@frondeau I don't understand your question. The diff, https://git.drupalcode.org/project/drupal/-/merge_requests/6453.diff, applies to the 10.2.x branch as well as to version 10.2.2.
- π«π·France frondeau Nantes, FRANCE
@catch,
after having applyed the patch, cleared the browsers cache, cleared Drupal caches, the issue is still the same, on the document: "Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR
"
Document Content-Leght: 138720
Content-Encoding: gzipAdditional information:
On the first page load, the error is displayed on css_* and js_* and document.
On the second page reload: the message is displayed only on document while all the assets are loaded from memory. - π¬π§United Kingdom catch
On the second page reload: the message is displayed only on document
Can you try temporarily disabling CSS and JavaScript aggregation (admin/config/development/performance) and let us know if you still see the same error anywhere? If so, then this isn't specific to BinaryFileResponse at all and could be a much wider problem with the content length header.
- π«π·France frondeau Nantes, FRANCE
Hi @catch, @cilefen,
I've removed the aggregation of css/js.- On the authenticated as admin on BO, JS and CSS are applied, there's no error message in the console.
- On anonymous session, the message "
Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR
" is still displayed on the document file.
FYI, I've already tested the front theme with Claro and the message is displayed too.
- π«π·France frondeau Nantes, FRANCE
Thanks for your answer, @alexpott,
I'll prepare some debug messages to check the ContentLenght handle and give a feedback on the conversation.. - π«π·France frondeau Nantes, FRANCE
Hi all,
Before adding logs in Drupal 10.2.2, I've created another migration with Drupal 10.1.8.
This version seems to work well at first sight:- no message in the console
- JS are working
- No errors in dblog
Some functional tests will follow to confirm, but it is promising as this.
How can we solve the error "Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR
" version 10.2.2 ? Hi,
I have exactly the same problem as you with the same configuration. Strangely, there's no problem when I'm logged in, only when I'm anonymous.
- π«π·France MiniDream
Hi i have the same problem as you on 10.2.4... after a migration from 9.5.. and im on OVH too
to add more information, i got the same error on some ajax update request such as custom batch step who need me manualy refresh the page to see what batch update.. and somme other custom ajax request ending the same way... - π¬π§United Kingdom longwave UK
I wonder if this is the same as the issue described at https://github.com/symfony/symfony/issues/46449#issuecomment-1140985890 - which also related to Drupal and the Content-Length header on OVH hosting.
It appears that
zlib.output_compression
is not enabled on OVH but perhaps they are doing something else to compress content which is breaking Content-Length somehow. - π«π·France frondeau Nantes, FRANCE
Hi all,
thank you to have reported the solution @lonwave.
Your propositionHeader always unset Content-Length
in your comment https://www.drupal.org/project/drupal/issues/3419024#comment-15431735 π Incorrect content-length header breaks HTTP/2 with net::err_http2_protocol_error Active is working for me on Drupal 10.2.2.
Regards. - π¬π§United Kingdom catch
Hid the MR because that was a complete red herring.
@frondeau Drupal's .htaccess file is intended to be modifiable, we won't add OVH-specific information in there since it could get confusing for sites that don't run into this problem.
However we could add this information to the change record for the issue that added the content length header and/or Drupal 10.2.0 release notes as a known issue.
- π«π·France mably
#35 seems to also fix some stability problems when running locally on Docker (Drupal 10.2.3, PHP 8.3, Apache with Nginx proxy).
- π«π·France frondeau Nantes, FRANCE
@catch,
I agree with you to avoid the comment ot include "OVH" term but this solution could be added as comment with a title of type "In case of ContentLength issue"
As a comment, it could provide a direct solution for the developers.
Regards. - π³π±Netherlands MLZR Zutphen
#35 + issue https://www.drupal.org/project/drupal/issues/3432990 π Content-length incorrect and response truncated in web servers Active works for me.
1. Set 'Header always unset Content-Length' in the .htaccess AND
2. Patch /public_html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php #48:
From: $response->headers->set('Content-Length', strlen($content), TRUE);
To: $response->headers->set('Content-Length', strlen($content)+2, TRUE);Thanks @longwave and the referrer to issues #3432990
Marcel
- π§πͺBelgium michelrrr
Thanks #35 !!
My config was :
OVH
10.1.8 ALL FINE, no problem
10.2.x migration => HTTP/2 with net::err_http2_protocol_errorSolved by adding 'Header always unset Content-Length' in .htaccess of www
<IfModule mod_headers.c> Header onsuccess unset X-Content-Type-Options Header always set X-Content-Type-Options nosniff Header always unset Content-Length RequestHeader unset Proxy </IfModule>
Hi everyone!
It was an image upload issue on my side and got errors. First patched like below; the error gone, uploaded successfully.
Patch /public_html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php #48: From: $response->headers->set('Content-Length', strlen($content), TRUE); To: $response->headers->set('Content-Length', strlen($content)+2, TRUE);
But then some http2 protocol errors appeared on XHR requests. After billion attempts, changed the patch like (switching from +2 to +1) and errors gone forever.
$response->headers->set('Content-Length', strlen($content)+1, TRUE);
- π«π·France sneo
Same error for me with 10.3.2.
With #35 the loading of my Js continue, but i can have some slowness for some page.
It' very visible because the first image to be loaded is a 50px of width (then the correct image is loaded ) Some page may took 1sec or more to complete load properly.So for me, it's not really a complete solution.
All was fine on my Dev server (Nginx) but as soon i migrate to an OVH performance ... Issues on chrome.
Does anyone had the same issue on another environment ? - π¨πΏCzech Republic mkolar
Same issue on AWS. Currently trying to update to 10.2.4 and got this error..