Verawood#38
Conversation
| {%- if MFE_EXTENSIONS_BY_PATH and get_frontend_apps() %} | ||
| # Frontend-site bundles (e.g. runtime.*.js) are served from /openedx/dist/site at the | ||
| # MFE root. When hosting by path on the LMS domain, proxy those asset paths to mfe. | ||
| @mfe_frontend_site_assets { | ||
| path_regexp assets ^/(runtime|app|cssLayerOrder|[0-9]+|[a-z0-9-]+-main)\.[a-f0-9]+\.(js|css)$ | ||
| } | ||
| handle @mfe_frontend_site_assets { | ||
| reverse_proxy mfe:8002 { | ||
| header_up Host {host} | ||
| } | ||
| } | ||
| {%- endif %} |
There was a problem hiding this comment.
I would need to test it first, but at first glance I have some doubts about this configuration.
Correct me if I’m wrong, but after reviewing this issue overhangio/tutor-mfe#285
I don’t see anything that would require changing the behavior of the main Caddy to serve those assets. My understanding is that, even though the files are now served from /openedx/dist/site, they should still follow the same logic as before, so the request should continue reaching the MFE Caddyfile (mfe:8002), and that Caddyfile should handle looking for the files in the corresponding path.
Did you try mfe-extension without this change? If so, what error do you get?
There was a problem hiding this comment.
In legacy MFEs those assets live under /{app}/ and /instructor-dashboard/* → mfe:8002 is enough.
For frontend-site apps, webpack still emits root-level bundles (/runtime..js, /instructor-dashboard-main..js). I tested without this patch: HTML under /instructor-dashboard/ works, but /runtime.*.js returns 404 from the LMS (never hits mfe:8002). That matches a blank instructor dashboard. This patch only proxies those root asset paths to mfe:8002 when BY_PATH + frontend apps are enabled.
Description
Extends MFE_EXTENSIONS_BY_PATH support for tutor-mfe verawood release and new frontend-site apps (e.g. instructor-dashboard).
Problem
On verawood, instructor-dashboard is a frontend app (is_frontend_app_enabled), not a legacy entry in MFE_APPS. With BY_PATH enabled:
Importan Changes
plugin.py
Extend iter_mfes_per_service() to yield enabled frontend apps from get_frontend_apps() / is_frontend_app_enabled(), in addition to legacy MFE_APPS.
caddyfile-frontend-site-assets (new) + caddyfile-lms
Proxy hashed webpack assets at the LMS root to mfe:8002 when BY_PATH is on and frontend apps exist.
Matcher covers runtime, app, numeric chunks, cssLayerOrder, and {app}-main bundles (e.g. instructor-dashboard-main..js). Beacause Frontend-site assets are served from /openedx/dist/site at / on the MFE container; on apps. that works on the same host, but on the LMS only /instructor-dashboard/* was proxied, causing blank pages / “unexpected error”.
Relevant links