1

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
  • 1
    You want to disable Big Pipe for a specific node but not for all nodes? Then I would add a route for this specific path and disable Big Pipe with the route option _no_big_pipe. Specific routes have priority over more general routes. Commented Aug 29, 2024 at 7:10
  • Thanks @4uk4. If you don't mind adding an answer with the approach you suggest, then I'd be happy to try it out and mark as answered. Commented Aug 29, 2024 at 16:18

2 Answers 2

1

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' 
2
  • This is a beautiful demonstration of deep Drupal knowledge. Thank you! Commented 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? Commented Aug 29, 2024 at 21:55
0

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 []; } 
1
  • 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. Commented Aug 30, 2024 at 6:40

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.