drupal-with-nginx
drupal-with-nginx copied to clipboard
CSS and JS being cut off/truncated, seemingly randomly
Hi,
I have a Drupal 8 site running on my Mac locally. The theme's CSS is being compiled using Gulp.
Often, after making a change and refreshing the page, the CSS will be corrupted, with a few lines stripped off the end. Depending on the exact makeup of the file, this could go from having one thing being unstyled, to completely breaking all styling. Sometimes it rectifies itself by hard refreshing multiple times (or opening the CSS file directly in the browser and hard refreshing that)... sometimes it's fixed by a cache clear. Sometimes it's fixed by just force rebuilding the file.
I tested it out by running wc -c style.css && curl -sI http://mysite.local/blah/style.css | grep -i Content-Length
, which when working fine would result in:
44381 css/style.css
Content-Length: 44381
But sometimes would come out with a mismatch:
44120 css/style.css
Content-Length: 43996
In the Chrome network tab, it states that the CSS file is returning a ERR_EMPTY_RESPONSE
.
The two things I tried were to set sendfile off;
in nginx.conf, and to set expires 0;
in drupal.conf for the static files directive. I can't think of anything else to troubleshoot- could you give some guidance please?
Thanks in advance, Matt