-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix: improve the redirect mktg url logic #37404
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
97e26e3
114cb68
2528c86
393c08e
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 |
|---|---|---|
|
|
@@ -58,7 +58,13 @@ def index(request): | |
| 'MKTG_URLS', | ||
| settings.MKTG_URLS | ||
| ) | ||
| return redirect(marketing_urls.get('ROOT')) | ||
| marketing_root = marketing_urls.get('ROOT') | ||
|
|
||
| # Prevent redirect loop: if LMS_ROOT_URL equals marketing ROOT, redirect to sign-in | ||
| lms_root_url = getattr(settings, 'LMS_ROOT_URL', '').rstrip('/') | ||
| if marketing_root and (marketing_root.rstrip('/') == lms_root_url): | ||
| return redirect('signin_user') | ||
|
Contributor
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.
Thanks for any thoughts on this front. We can't update edge settings until this PR lands in some form.
Contributor
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. So the situation is that you "ENABLE_MKTG_SITE" is set to true because you want to use "MKTG_URLS" for the various places where they are used, but you don't actually want to change the Marketing Root URL? I think rather than forcing a login flow, we just need to update this so that in the case of the match, we don't do any redirects and just fall through to the rendering of the
Contributor
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.
Contributor
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. Sounds good, yea I think we can code in the assumption that this should work with that, and if we do remove that later, we can make sure that whatever the new default behavior is, will still work. I think the eventual default is going to be the MFE redriect, but the old view will exist until the New catalog MFE is the default.
Contributor
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. @feanil: I'm not comfortable rushing a fix in. I don't yet know how this would affect Edge, and I imagine that the student_view wouldn't be appropriate for non-students. How would you feel about getting a more complete replacement in for Verawood, including possible new MFE redirects, etc., and then bumping the removal to the W release? I want to avoid having urgent changes around cut dates that don't feel like they need to be urgent.
Contributor
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.
The bug is that now that MARKETING_URLS is a required setting, there will the
Contributor
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. @feanil: Your proposal is not a backward compatible replacement for Edge, but since the code is clearly 2U-specific, I understand that that may not matter to you. So, I'll leave this back in your hands to proceed how and when you wish. You are welcome to take over this PR if you want to have a backward-compatible fix for others in Ulmo. Your proposal won't address our needs, and I don't want orbi-bom to have to work urgently on this, because it doesn't affect us. Thanks and let me know if you have any questions.
Contributor
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. An alternative PR with my suggested fix: #37510 FWIW, the 2U code is still there and should behave as it did before. This PR would just not change the behavior for everyone else also.
Contributor
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. Yes, the main goal here is to enable MKTG_URLS without triggering unnecessary redirects when the ROOT matches LMS_ROOT_URL. We’re not looking to change the marketing root behavior just to prevent regressions when ENABLE_MKTG_SITE is True but the URLs are aligned.
Contributor
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 think #37510 should resolve this issue then. I've marked it ready for review. |
||
| return redirect(marketing_root) | ||
|
|
||
| domain = request.headers.get('Host') | ||
|
|
||
|
|
||
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.
[reminder] Once the dust settles, we'll want to update unit tests.