michael-s-molina opened a new pull request, #40120:
URL: https://github.com/apache/superset/pull/40120

   ### SUMMARY
   
   Extension asset filenames (JS, WASM chunks) include a content hash, making 
them immutable by definition. However, two issues prevented browsers from 
caching them:
   
   1. The API endpoint returned no `Cache-Control` headers, so browsers 
defaulted to no-cache behavior.
   2. Flask's session machinery injects `Vary: Cookie` on every response 
whenever the session object is touched by any `after_request` hook in the 
pipeline — even ones unrelated to the extension endpoint. This tells browsers 
the response varies per cookie, making URL-based caching ineffective.
   
   **Changes:**
   - `superset/extensions/api.py`: Set `Cache-Control: public, 
max-age=31536000, immutable` on extension static asset responses.
   - `superset/extensions/middleware.py`: New WSGI middleware 
(`ExtensionStaticCacheMiddleware`) that strips `Cookie` from the `Vary` header 
on extension asset URLs after all Flask hooks have run.
   - `superset/initialization/__init__.py`: Register the new middleware.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — backend caching header change only.
   
   ### TESTING INSTRUCTIONS
   
   1. Run Superset with at least one extension installed.
   2. Open DevTools → Network tab, filter by the extension asset URL (e.g. 
`/api/v1/extensions/<publisher>/<name>/<file>`).
   3. **Before**: Response has `Vary: Cookie` and no `Cache-Control`; 
subsequent requests are not served from disk cache.
   4. **After**: Response has `Cache-Control: public, max-age=31536000, 
immutable` and no `Cookie` in `Vary`; subsequent requests are served from disk 
cache (status 200 from cache / 304).
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] 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]

Reply via email to