Repository navigation
Closed
Labels
code healthProactive technical investment via refactorings, removals, etc.maintenanceRoutine upkeep necessary for the health of the platform
Description
Acceptance criteria:
- StaticContentServer is converted from a middleware to a view
- The cutover is managed with a Waffle flag or similar to allow careful rollout
- Documentation added to next Open edX named-release notes
- Optional: Additional cleanup
- Remove temporary
IMPLvariable andStaticContentServerclass by lifting methods to module scope - Separate views for different URL patterns
- Remove temporary
Course asset URLs like /asset-v1:... are served from a middleware at openedx.core.djangoapps.contentserver.middleware.StaticContentServer rather than from a view. This means that Django starts handling the request as a Not Found (because there is no matching urlpattern), but then the middleware intercepts the request and returns a response of its own. There wasn't any good reason for doing this instead of using a view, as far as I can tell. It causes some problems for telemetry: When the code-owner middleware asks Django what view handled the request, it does so by looking at the result of the resolve utility, but these URLs get a Resolver404 (because there's no registered urlpattern).
Implementation suggestion:
- Register equivalent urlpatterns and a view that calls into the same code the middleware currently contains.
- Add a Waffle flag that causes the middleware to fall through to the view.
- Try turning the flag on.
- Remove the middleware so that the view is always used.
- [Beyond this ticket:] Bring the new view's code up to standards (better use of urlpatterns, etc.)
PRs:
- Refactor to add urlpatterns and allow use of a view via a flag: feat: Start conversion of StaticContentServer from middleware into view #34703
- A fix for that PR: fix: Fix matching of /c4x/ in course asset view urlpatterns #35247
- Switch permanently to view: feat: Convert contentserver to view permanently (drop middleware and flag) #35420
- Removal of StaticContentServer wrapper class: refactor: Clean up after conversion of contentserver to view #35559
Reacted by Feanil Patel
Metadata
Metadata
Assignees
Labels
code healthProactive technical investment via refactorings, removals, etc.maintenanceRoutine upkeep necessary for the health of the platform
Activity
feat: Start conversion of StaticContentServer from middleware into view
kdmccormick commentedon May 29, 2024
+1. This seriously confused Connor and I today!
feat: Start conversion of StaticContentServer from middleware into vi…
timmc-edx commentedon Jun 10, 2024
Private 2U dashboard for monitoring cutover: https://app.datadoghq.com/dashboard/vjs-j3j-czr
[-]Course assets are served by a middleware rather than a view[/-][+]Course assets should be served by a view rather than a middleware[/+]robrap commentedon Jun 11, 2024
We don't actually own this, and it is no longer a high priority, but we might be able to help with rollout.
jristau1984 commentedon Aug 5, 2024
@timmc-edx is this work complete, or is there anything left to do?
10 remaining items
fix: Fix matching of /c4x/ in course asset view urlpatterns
fix: Fix matching of /c4x/ in course asset view urlpatterns (#35247)
timmc-edx commentedon Aug 8, 2024
edx.org has been converted over successfully. We'll let this bake for a week or two in production and then we can move the implementation properly into views.py and remove the old middleware.
robrap commentedon Aug 26, 2024
@timmc-edx: FYI: I moving this out of blocked because it has sufficiently baked based on your last comment.
feat: Convert contentserver to view permanently (drop middleware and …
feat: Convert contentserver to view permanently (drop middleware and …
timmc-edx commentedon Sep 10, 2024
This is largely complete, and now just wants a bit of optional cleanup. Acceptance criteria updated.
refactor: Fix content server methods and tests (finish method lift)
refactor: Fix content server methods and tests (finish method lift)
timmc-edx commentedon Sep 30, 2024
Closing out -- last bit of cleanup would involve turning this into three views, and probably isn't worth the effort right now.
feat: call python methods from forum v2