Skip to content

Add configurable next_url for OpenEdX Hawthorn login/register redirects#2795

Open
igobranco wants to merge 1 commit intoopenfun:masterfrom
igobranco:igobranco/add-option-to-change-next-param-on-openedx
Open

Add configurable next_url for OpenEdX Hawthorn login/register redirects#2795
igobranco wants to merge 1 commit intoopenfun:masterfrom
igobranco:igobranco/add-option-to-change-next-param-on-openedx

Conversation

@igobranco
Copy link
Copy Markdown
Collaborator

Summary

The OpenEdX Hawthorn API previously hardcoded the richie prefix in the
?next= query parameter used during login and register redirects
(e.g. ?next=richie/courses/...). This prefix is used by OpenEdX's Nginx
configuration to identify that the redirect target belongs to the Richie
application.

This PR makes that prefix configurable per LMS backend, allowing sites with
custom Nginx routing rules to set their own prefix.

This allows to have multiple Richie sites connected to the same Open edX LMS.
And the Open edX redirects to the right Richie site during login/register redirects.

Changes

Backend

  • Added JS_NEXT_URL optional setting to RICHIE_LMS_BACKENDS configuration
    (defaulting to "richie" if not set)
  • Updated FrontendContextProcessor.get_lms_context() to include next_url
    in the frontend context when JS_NEXT_URL is configured
  • Added tests for the LMS context processor covering: no backends, missing
    JS_NEXT_URL, present JS_NEXT_URL, and mixed multi-backend scenarios

Frontend

  • Added optional nextURL option to APIOptions type
  • Added optional next_url field to LMSBackend and AuthenticationBackend
    types
  • Updated OpenEdxHawthornApiInterface to use options?.nextURL
    (falling back to "richie") for login/register redirects
  • Updated LMSHandler to pass next_url from the backend config through to
    OpenEdxHawthornApiInterface
  • Added tests for default and custom next_url behavior in both the Hawthorn
    API and the LMS handler

How to configure

RICHIE_LMS_BACKENDS = [
    {
        "BASE_URL": "https://lms.example.com",
        "JS_BACKEND": "openedx-hawthorn",
        "JS_COURSE_REGEX": r"...",
        "JS_NEXT_URL": "richie-mysite",  # optional, defaults to "richie"
    }
]

@igobranco igobranco self-assigned this Apr 15, 2026
Add support for a configurable `JS_NEXT_URL` setting per LMS backend
that controls the prefix used in the `?next=` parameter during
login/register redirects in the OpenEdX Hawthorn API.

Previously the prefix was hardcoded to "richie". It can now be set per
backend via `JS_NEXT_URL` in `RICHIE_LMS_BACKENDS` settings and is
exposed to the frontend through the context processor as `next_url` on
each LMS backend entry.
@igobranco igobranco force-pushed the igobranco/add-option-to-change-next-param-on-openedx branch from a163cad to efa606c Compare April 15, 2026 14:29
@igobranco igobranco marked this pull request as ready for review April 15, 2026 15:30
@igobranco igobranco requested review from kernicPanel and liamls April 15, 2026 15:32
Copy link
Copy Markdown
Contributor

@liamls liamls left a comment

Choose a reason for hiding this comment

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

I have noticed an issue which may be blocking : the cookie cutter template is not updated here and should be added next to the other settings so generated projects expose this option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants