MFE runtime configuration in dev mode was not working properly prior to this. It would always end up querying the example.com site configuration. With this change, we force the request origin to always be the LMS host and port, as opposed to something like apps.local.edly.io:2001, which would trip up the Django site detection.
Reproducing and testing
To reproduce (and test) the problem:
Check out an MFE locally. For instance, the learner dashboard: git clone https://github.com/openedx/frontend-app-learner-dashboard
Configure a local mount for the MFE. tutor mounts add ./frontend-app-learner-dashboard
Launch Tutor in dev mode: tutor dev launch. (This should rebuild the appropriate images.)
To test the fix, check out this branch, save configuration, (tutor config save), rebuild the learner dashboard dev image with tutor images build learner-dashboard-dev, and restart the dev environment. You should then be able to see the "BOGUS" entry.
Description
MFE runtime configuration in dev mode was not working properly prior to this. It would always end up querying the
example.com
site configuration. With this change, we force the request origin to always be the LMS host and port, as opposed to something likeapps.local.edly.io:2001
, which would trip up the Django site detection.Reproducing and testing
To reproduce (and test) the problem:
git clone https://github.com/openedx/frontend-app-learner-dashboard
tutor mounts add ./frontend-app-learner-dashboard
tutor dev launch
. (This should rebuild the appropriate images.)local.edly.io:8000
entry, add an override for the dashboard such as:To test the fix, check out this branch, save configuration, (
tutor config save
), rebuild the learner dashboard dev image withtutor images build learner-dashboard-dev
, and restart the dev environment. You should then be able to see the "BOGUS" entry.Further information
For reference on
changeOrigin
, see https://webpack.js.org/configuration/dev-server/#devserverproxy and https://github.com/chimurai/http-proxy-middleware?tab=readme-ov-file#http-proxy-options.