bikash-barnwal opened a new pull request, #43169: URL: https://github.com/apache/superset/pull/43169
### SUMMARY `AppRootMiddleware.__call__` returned `NotFound()` for any request whose `PATH_INFO` did not start with the configured app root. Webpack compiles the frontend with `/static/assets/` as its `publicPath`, which is baked into the bundle at build time, so lazily loaded chunks and the assets they reference are requested **without** the app-root prefix. Under `SUPERSET_APP_ROOT=/analytics` those requests were rejected with a 404, so the logo, CSS and JS chunks failed to load. `STATIC_ASSETS_PREFIX` defaults to the app root, which covers the URLs Superset generates server-side, but it cannot affect paths webpack already hard-coded into the bundle. This adds a passthrough branch for unprefixed `/static/` paths. `PATH_INFO` and `SCRIPT_NAME` are deliberately left untouched there, because the static route is registered at `/static/...` on the unprefixed app. The app-root branch is still checked first, so `/analytics/static/assets/...` continues to be stripped and remounted as before. Paths that merely contain `/static/` further along (`/other/static/assets/main.js`) or that only share a string prefix with the app root (`/analyticsfoo/...`) still 404. Scope note: only static assets are reachable through the new branch, and they are already served publicly at the prefixed path — no application route becomes reachable without the prefix. Also documents that a reverse proxy fronting a prefixed deployment has to forward `/static` in addition to the prefix, which is the configuration in the issue's reproduction. Fixes #39429 ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — no visual change beyond assets loading instead of 404ing. ### TESTING INSTRUCTIONS Automated: ```bash pytest tests/unit_tests/middleware/test_app_root_middleware.py ``` The new test module pins all three behaviors of the middleware: prefix stripping, `/static/` passthrough, and 404 for everything else. Manual: 1. Start Superset with `SUPERSET_APP_ROOT=/analytics`. 2. Request `http://localhost:8088/static/assets/images/superset-logo-horiz.png` — 200 on this branch, 404 on `master`. 3. Request `http://localhost:8088/analytics/static/assets/images/superset-logo-horiz.png` — still 200 (unchanged). 4. Request `http://localhost:8088/dashboard/list/` — still 404 (unchanged). 5. Load `http://localhost:8088/analytics` and confirm no `/static/assets/*` 404s in the browser network tab. ### ADDITIONAL INFORMATION - [x] Has associated issue: #39429 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
