From 0cc2d734ffad986d59e80ca0733050b8038a9e40 Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Tue, 6 Feb 2024 09:59:41 -0300 Subject: [PATCH] fix: Runtime config in dev mode MFE runtime configuration 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. --- .../20240206_100528_arbrandes_fix_dev_runtime_config.md | 1 + tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog.d/20240206_100528_arbrandes_fix_dev_runtime_config.md diff --git a/changelog.d/20240206_100528_arbrandes_fix_dev_runtime_config.md b/changelog.d/20240206_100528_arbrandes_fix_dev_runtime_config.md new file mode 100644 index 00000000..57bad651 --- /dev/null +++ b/changelog.d/20240206_100528_arbrandes_fix_dev_runtime_config.md @@ -0,0 +1 @@ +- [Bugfix] Fix MFE runtime config via site configuration in dev mode (by @arbrandes). diff --git a/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js b/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js index ee7f9ccb..8f27e025 100644 --- a/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js +++ b/tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js @@ -15,7 +15,10 @@ module.exports = merge(baseDevConfig, { // https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md allowedHosts: 'all', proxy: { - '/api/mfe_config/v1' : 'http://{{ LMS_HOST }}:8000', + '/api/mfe_config/v1': { + target: 'http://{{ LMS_HOST }}:8000', + changeOrigin: true, + } } }, })