Skip to content

Move RedirectMiddleware to appsembler.settings plugin - #817

Merged
bryanlandia merged 6 commits into
appsembler/tahoe/developfrom
appsembler/tahoe-move-middleware-to-settings-plugins
Feb 19, 2021
Merged

Move RedirectMiddleware to appsembler.settings plugin#817
bryanlandia merged 6 commits into
appsembler/tahoe/developfrom
appsembler/tahoe-move-middleware-to-settings-plugins

Conversation

@bryanlandia

Copy link
Copy Markdown

Split out original edX Django Extensions RedirectMiddleware (Redirect model-based 302s) from Tahoe-specific redirect middleware for default site minus whitelisted paths. Use appsembler.sites.middleware.RedirectMiddleware when enabled via settings. Default to enabled.

This change allows us to skip this behavior on standalone installs.

Add the first tests for this feature, too!

Use the django_sites_extensions RedirectMiddleware, but
if TAHOE_ENABLE_DOMAIN_REDIRECT_MIDDLEWARE enabled (default ON), then
insert related middleware classes before that standard redirect class.
@bryanlandia

Copy link
Copy Markdown
Author

Another possibly annoying but hopefully useful PR from me 😺

@bryanlandia
bryanlandia marked this pull request as draft February 4, 2021 20:12
# Soooo just in case
beeline.add_trace_field("redirect_middleware_exception", True)
pass
cache_key = '{prefix}-{site}'.format(prefix=settings.REDIRECT_CACHE_KEY_PREFIX, site=site.domain)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

all this and below are in original django_sites_extensions.middleware.RedirectMiddleware

@bryanlandia
bryanlandia marked this pull request as ready for review February 4, 2021 20:51
@OmarIthawi

Copy link
Copy Markdown

@bryanlandia can I take a moment and give big thanks to what you've been doing? I still didn't check this PR, but it looks like a straight-to merge PR. I will take a look soon.

@OmarIthawi

Copy link
Copy Markdown

Sorry for the delay here. I've been focusing on a rather important bug: RED-1698. Please let me know if this is a blocker or could wait few more days.

I've added two more reviewers to hopefully get a faster triage.

@thraxil thraxil left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM. The flag defaults to True, so existing Tahoe deployments shouldn't have to change their settings.

We just have to remember that this needs to move to production_lms.py when applying it to the juniper branch.

@OmarIthawi OmarIthawi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I've added a suggestion to ensure the order is correct. Apart from that the PR looks good to me. Thanks @bryanlandia!

Comment thread openedx/core/djangoapps/appsembler/settings/settings/aws_lms.py Outdated
committing Omar's suggestion

Co-authored-by: Omar Al-Ithawi <i@omardo.com>
@bryanlandia
bryanlandia merged commit d7c4265 into appsembler/tahoe/develop Feb 19, 2021
@bryanlandia
bryanlandia deleted the appsembler/tahoe-move-middleware-to-settings-plugins branch February 19, 2021 05:54
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.

4 participants