-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix: redirect to account MFE when using any legacy account URL #36894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| """ | ||
| Defines the URL routes for this app. | ||
| """ | ||
| from django.conf import settings | ||
| from django.urls import path, re_path, include | ||
| from django.views.generic import RedirectView | ||
| from rest_framework import routers | ||
|
|
||
| from . import views as user_api_views | ||
|
|
@@ -12,6 +14,10 @@ | |
| USER_API_ROUTER.register(r'user_prefs', user_api_views.UserPreferenceViewSet) | ||
|
|
||
| urlpatterns = [ | ||
| # This redirect is needed for backward compatibility with the old URL structure for the authentication | ||
| # workflows using third-party authentication providers until the authentication workflows fully support | ||
| # the URL structure with MFEs. | ||
| re_path(r'^account(?:/settings)?/?$', RedirectView.as_view(url=settings.ACCOUNT_MICROFRONTEND_URL)), | ||
| path('user_api/v1/', include(USER_API_ROUTER.urls)), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why you made the suffix
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like LMS/account also returns 404 which I think should also redirect to the account mfe. What do you think?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note sure if it's suppose to redierct from
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mmm I see what you say. But when using LMS base domain == MFE domain, /account will redirect to the account MFE. Does that make sense?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made a correction in my earlier comment, I meant from
when/if (LMS base domain == MFE domain), then it will a add new diemension to the problem, of which I haven't tried or setup before. Is there a sandbox with such setup?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. edunext has a few with that setup, it has another issues I think (not related to this, but to MFEs themselves) but all of them are solved here https://github.com/eduNEXT/tutor-contrib-mfe-extensions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aha gotcha... I think then may be since redirection is at caddy level, it would get redirected before reaching django urls roles. Nonetheless, the project provide an intresting solution for the multiesite and MFEs. |
||
| re_path( | ||
| fr'^user_api/v1/preferences/(?P<pref_key>{UserPreference.KEY_REGEX})/users/$', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment here explaining why this exists. I'm generally fine with adding backwards compatibility redirects, even if we've already ripped out references to it in our own codebase (because URLs stick around for a long time in other systems).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, agreed!