Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions openedx/core/djangoapps/user_api/legacy_urls.py
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
Expand All @@ -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)),

Copy link
Copy Markdown
Contributor

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).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, agreed!

path('user_api/v1/', include(USER_API_ROUTER.urls)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you made the suffix /settings in url path as optional? i

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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?

@ghassanmas ghassanmas Jun 11, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note sure if it's suppose to redierct from /account, AFAIK lms_base/account on sumac didn't redirect to account mfe.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a correction in my earlier comment, I meant from lms.base/account

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?

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?

@mariajgrimaldi mariajgrimaldi Jun 18, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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/$',
Expand Down