I have a specific page where I'd like to disable Big Pipe. The route of that page is entity.node.canonical, so I don't think doing an alterRoutes() is the correct approach. What other options do I have?
2 Answers
Add a specific route for the node and disable Big Pipe by adding the option _no_big_pipe:
mymodule.routing.yml
node.2: path: '/node/2' defaults: _title_callback: '\Drupal\node\Controller\NodeViewController::title' _controller: '\Drupal\node\Controller\NodeViewController::view' node: 2 options: _no_big_pipe: TRUE requirements: node: '\d+' _entity_access: 'node.view' - This is a beautiful demonstration of deep Drupal knowledge. Thank you!infojunkie– infojunkie2024-08-29 19:00:09 +00:00Commented Aug 29, 2024 at 19:00
- It does disable Big Pipe, but: a) I can't edit the node anymore b) Would it be possible to use the path alias instead of hard-coding the node id?infojunkie– infojunkie2024-08-29 21:55:23 +00:00Commented Aug 29, 2024 at 21:55
I am currently using a different approach than below, based on Wim Leers' Big Pipe strategy demo.
In a nutshell, in the part where the code decides to ignore the Big Pipe placeholders, I perform my URL detection:
$current_uri = \Drupal::request()->getRequestUri(); if (str_starts_with($current_uri, '/path/to/page-to-ignore')) { return []; } - OK, if you are willing to decorate this service in your custom module you have maximum control over the Big Pipe strategy. Then you can make decisions depending on the current request which a static route definition can't do.4uk4– 4uk42024-08-30 06:40:36 +00:00Commented Aug 30, 2024 at 6:40
_no_big_pipe. Specific routes have priority over more general routes.