Repository navigation
fix (html5/bbb-web): Preloading of slides not working for proxy setups - #25108
Conversation
WalkthroughThis PR implements credential-aware CORS handling for presentation slide assets. Nginx gains a configurable Sequence Diagram(s)sequenceDiagram
participant Browser
participant Nginx
participant BBB_HTML5
Browser->>Nginx: GET /presentation/... (fetch credentials: 'include')
Nginx->>BBB_HTML5: proxy_pass request for asset
BBB_HTML5-->>Nginx: 200 + asset (svg) + CORS headers (Access-Control-Allow-Origin: $bbb_cors_origin)
Nginx-->>Browser: 200 + asset + Access-Control-Allow-Origin: $bbb_cors_origin + Access-Control-Allow-Credentials: true
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/docs/administration/cluster-proxy.md (1)
147-167:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd a language identifier to the fenced code block.
The block is nginx config; adding the language fixes markdown lint and improves rendering.
📝 Suggested edit
-``` +```nginx # Enable per-origin CORS # Required because the HTML5 client is served from the proxy origin while slides (and other requests) # are fetched directly from this BBB node with credentials set $bbb_cors_origin 'https://bbb-proxy.example.com'; ... -``` +```🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/docs/administration/cluster-proxy.md` around lines 147 - 167, The fenced code block containing the nginx configuration (starts with the lines including "set $bbb_cors_origin 'https://bbb-proxy.example.com';" and the "location /bbb-01/html5client" blocks) needs a language identifier for proper markdown linting and rendering — change the opening fence from ``` to ```nginx so the block is recognized as nginx config.bigbluebutton-html5/imports/ui/components/presentation/container.jsx (1)
206-217:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse
.finally()to restorecanFetchon fetch failures.If any
fetchrejects (network/CORS error),Promise.all()rejects and skips the.then()callback, leavingpresentation.canFetch = falsepermanently. This blocks all subsequent preloads since the gate on line 201 requirespresentation.canFetchto be true.Suggested fix
Promise.all(promiseImageGet) + .catch(() => { + // Ignore individual preload failures; keep preloading pipeline alive. + }) - .then(() => { + .finally(() => { presentation.canFetch = true; - }); + });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bigbluebutton-html5/imports/ui/components/presentation/container.jsx` around lines 206 - 217, The current preload flow sets presentation.canFetch = false before awaiting fetches and only sets it back in Promise.all(...).then(...), so any rejected fetch leaves presentation.canFetch false; update the Promise.all call used with promiseImageGet so it uses .finally(...) to restore presentation.canFetch = true regardless of success or failure (keep the existing logic where individual successful fetches set presentation.fetchedSlide[slide.svgUrl] = true inside the mapped async function), ensuring presentation.canFetch is set to false before starting the map and always reset in the Promise.all(...).finally(...) callback.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/docs/administration/cluster-proxy.md`:
- Around line 143-145: Fix the typo "raplace" to "replace" and reword the two
bullets for clarity: change the line containing "raplace bbb-proxy.example.com
with your proxy for $bbb_cors_origin" to "replace bbb-proxy.example.com with
your proxy for $bbb_cors_origin", and clarify the second bullet "prepend the
mount point of bbb-html5 in all location sections" to explicitly state which
mount point to prepend (for example "prepend the bbb-html5 mount point (e.g.,
/bbb-html5) to all location paths/blocks in the configuration"). Ensure you
update the exact phrases "raplace bbb-proxy.example.com with your proxy for
$bbb_cors_origin" and "prepend the mount point of bbb-html5 in all location
sections" in the document.
---
Outside diff comments:
In `@bigbluebutton-html5/imports/ui/components/presentation/container.jsx`:
- Around line 206-217: The current preload flow sets presentation.canFetch =
false before awaiting fetches and only sets it back in
Promise.all(...).then(...), so any rejected fetch leaves presentation.canFetch
false; update the Promise.all call used with promiseImageGet so it uses
.finally(...) to restore presentation.canFetch = true regardless of success or
failure (keep the existing logic where individual successful fetches set
presentation.fetchedSlide[slide.svgUrl] = true inside the mapped async
function), ensuring presentation.canFetch is set to false before starting the
map and always reset in the Promise.all(...).finally(...) callback.
In `@docs/docs/administration/cluster-proxy.md`:
- Around line 147-167: The fenced code block containing the nginx configuration
(starts with the lines including "set $bbb_cors_origin
'https://bbb-proxy.example.com';" and the "location /bbb-01/html5client" blocks)
needs a language identifier for proper markdown linting and rendering — change
the opening fence from ``` to ```nginx so the block is recognized as nginx
config.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1ee39e74-70f8-4ca2-8fea-0a71b61c8f56
📒 Files selected for processing (3)
bigbluebutton-html5/imports/ui/components/presentation/container.jsxbigbluebutton-web/nginx-confs/presentation-slides.nginxdocs/docs/administration/cluster-proxy.md
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/docs/administration/cluster-proxy.md (1)
147-147: ⚡ Quick winConsider adding a language specifier to the code fence.
Adding
nginxafter the opening triple backticks would enable syntax highlighting and satisfy the markdown linter.✨ Proposed improvement
-``` +```nginx # Enable per-origin CORS🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/docs/administration/cluster-proxy.md` at line 147, The Markdown code fence for the Nginx snippet (the block containing the comment "Enable per-origin CORS") is missing a language specifier; update the opening triple backticks to include "nginx" (i.e., change ``` to ```nginx) so the snippet is syntax-highlighted and the markdown linter is satisfied.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@docs/docs/administration/cluster-proxy.md`:
- Line 147: The Markdown code fence for the Nginx snippet (the block containing
the comment "Enable per-origin CORS") is missing a language specifier; update
the opening triple backticks to include "nginx" (i.e., change ``` to ```nginx)
so the snippet is syntax-highlighted and the markdown linter is satisfied.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2fe47a40-75f1-4e72-97b1-36d7703585dd
📒 Files selected for processing (1)
docs/docs/administration/cluster-proxy.md
✅ Automated tests have passed! |
|
Some suggestions:
Since you are refactoring anyway, maybe add another variable named |
I didn't have much experience with cluster setups back when But I checked the references now, and it seems to be obsolete. The last mentions I found were removals: https://github.com/bigbluebutton/bigbluebutton/pull/21361/changes So I'm not sure we should keep relying on it. Are you sure it is still used in production? Maybe the approach I suggested is safer, since it places the override file under I don't have a strong opinion here. You are much more familiar with proxy setups than I am, so your opinion is important. I'm just sharing what I found after a brief look into this. |
|
You are right, I only have experience deploying a proxy mode cluster using the Ansible role and never tried to do that manually. There are a LOT of changes necessary for proxy mode to work properly, and it's really easy to get wrong. That's probably why so few people actually do that, even though it's way more convenient for users. The role also handles nginx config quite differently. Okay, let's not over-complicate things. Your PR fixes the issue and I can update the Ansible role to set that variable if proxy mode is enabled. Works for me. We can clean up (an make this easier for admins that do this manually) later. |
Sounds like a plan. Thanks a lot for looking into it. |



In proxy setups, slide preloading is currently failing with
401 (Unauthorized)because slides now require authentication to be fetched by nginx.To fix this in HTML5, we need to include
{ credentials: 'include' }in thefetch()call.The second issue is that browsers do not allow credentials to be included when the request is made to a different origin. Because of that, we also need a CORS rule allowing the proxy domain.
I refactored the nginx file so the
Access-Control-Allow-Originvalue comes from a variable. This allows admins to define the value once and have it applied properly across all locations, instead of having to tweak each location individually.Looking ahead, we will likely need CORS rules for other locations too, such as
shared-notes-server. For that reason, I recommended in the documentation that admins set the CORS domain as an override in/etc/bigbluebutton/nginx/bbb-cluster.nginx. This way, the configuration will not be lost during BBB updates.By setting the variable there, we can also reuse it in other nginx files. The admin only needs to configure it once, and BBB can take advantage of it wherever needed.