I've just installed and enabled, and the first thing I get on a previously working dev site running Ngnix and https2 is 500 Bad Gateway. It's also possible you can see a 502 error.

It turns out that the problem is that the headers generated by PHP are too big when Push is enabled.

The exact solution depends on the configurations of your Nginx but most likely you will need to adjust your nginx.conf file to allow larger buffers. See https://stackoverflow.com/questions/23844761/upstream-sent-too-big-heade... for some discussion about what to change for various Nginx configurations.

A good starting point is:

fastcgi_buffers 16 16k; 
fastcgi_buffer_size 32k;

You may need to experiment to get the correct sizes.

Comments

Jeff Veit created an issue. See original summary.

jeff veit’s picture

I suggest that this info goes into the documentation/README or on the project page.

wim leers’s picture

Status: Active » Postponed (maintainer needs more info)

Any chance you don't have CSS+JS aggregation enabled? Only then would this add lots of headers.

jeff veit’s picture

Yeah Wim, I do: it's a dev environment at the moment.

wim leers’s picture

Title: May require webserver config changes » Only send Server Push headers when CSS+JS aggregation are enabled
Component: Documentation » Code
Category: Feature request » Task
Status: Postponed (maintainer needs more info) » Active

I guess I could change this to only work when CSS+JS aggregation is enabled, then this problem wouldn't occur anymore.

We'd then also want a warning in the status report that no Server Push will happen because CSS+JS aggregation are not enabled.

prudloff’s picture

StatusFileSize
new6.95 KB

We had the same issue in one of our dev environments.
The attached patch only adds assets to the Link header if JS or CSS preprocess is enabled.

prudloff’s picture

Status: Active » Needs review
wim leers’s picture

Status: Needs review » Needs work

Thanks, @prudloff! :)

  1. +++ b/src/Asset/CssCollectionRenderer.php
    @@ -48,30 +49,33 @@ class CssCollectionRenderer implements AssetCollectionRendererInterface {
    +    if (Drupal::config('system.performance')->get('css.preprocess')) {
    
    +++ b/src/Asset/JsCollectionRenderer.php
    @@ -48,30 +49,33 @@ class JsCollectionRenderer implements AssetCollectionRendererInterface {
    +    if (Drupal::config('system.performance')->get('js.preprocess')) {
    

    Rather than retrieving the relevant configuration by calling into a global singleton, we should inject the relevant configuration into the service.

  2. This still needs a status report entry.
wim leers’s picture

Assigned: Unassigned » wim leers

#8.2: On second thought, a status report entry is probably overkill. It obviously is weird to send dozens upon dozens of "preload" Link headers.

That leaves only #8.1. Will take that on.

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new1.31 KB
new6.31 KB
wim leers’s picture

Assigned: wim leers » Unassigned
Status: Needs review » Reviewed & tested by the community

🚢

  • Wim Leers committed 0513ee6 on 8.x-1.x
    Issue #2869110 by Wim Leers, prudloff, Jeff Veit: Only send Server Push...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.