Skip to content

Commit f00e0fa

Browse files
docs: explain a way to overcome CORS issue in example app
1 parent f229925 commit f00e0fa

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,33 @@ When making changes to frontend-platform, be sure to manually run the included e
149149

150150
If you want to test changes to frontend-platform against a micro-frontend locally, follow the directions here: https://github.com/openedx/frontend-build#local-module-configuration-for-webpack
151151

152+
## Getting the example app to work with a tutor dev environment
153+
154+
Part of the example app functionality includes an API request to get the logged in user's profile information. This request will fail by default due to CORS restrictions. One way to overcome this is to create a tutor plugin that patches the settings needed for the request to be allowed.
155+
156+
1. Create an `example.py` file with the following contents:
157+
158+
```python
159+
from tutor import hooks
160+
161+
hooks.Filters.ENV_PATCHES.add_items([
162+
(
163+
"openedx-lms-development-settings",
164+
"""
165+
# Used for the example app in the frontend-plugin library
166+
CORS_ORIGIN_WHITELIST.append("http://local.openedx.io:8080")
167+
LOGIN_REDIRECT_WHITELIST.append("local.openedx.io:8080")
168+
CSRF_TRUSTED_ORIGINS.append("http://local.openedx.io:8080")
169+
"""
170+
),
171+
])
172+
```
173+
174+
2. Install the plugin: `tutor plugins install example.py`
175+
3. Enable the plugin: `tutor plugins enable example`
176+
4. Restart the lms service: `tutor dev restart lms`
177+
5. http://local.openedx.io:8080/ should now successfully fetch the logged in user's name (if available)
178+
152179
# Production Deployment Strategy
153180

154181
For any MFE built on top of the frontend-platform, the deployment strategy will be something like the following:

0 commit comments

Comments
 (0)