OCPBUGS-70112: Add Cache-Control headers to console responses - #16923
OCPBUGS-70112: Add Cache-Control headers to console responses#16923jrangelramos wants to merge 1 commit into
Conversation
Set restrictive cache headers (no-cache, no-store) by default on all responses via WithSecurityHeaders, and override with aggressive caching (public, max-age=31536000, immutable) for content-hashed static assets under /static/. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@jrangelramos: This pull request references Jira Issue OCPBUGS-70112, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jrangelramos The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
WalkthroughThe middleware adds no-cache headers for protected responses and immutable public caching for static assets. The ChangesCache header middleware
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 12 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (12 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/jira refresh |
|
@jrangelramos: This pull request references Jira Issue OCPBUGS-70112, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (yapei@redhat.com), skipping review request. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@jrangelramos: This pull request references Jira Issue OCPBUGS-70112, which is valid. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Jira (yapei@redhat.com), skipping review request. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
manual verification $ curl -skI $CONSOLE_URL | grep -iE 'cache-control|pragma|expires'
cache-control: no-cache, no-store, must-revalidate
pragma: no-cache
$ curl -skI $CONSOLE_URL/static/main-bundle-135c35ac6fc8bd54.min.js | grep -iE 'cache-control|pragma|expires'
cache-control: public, max-age=31536000, immutable
cache-control: private
$ curl -skI $CONSOLE_URL/api/console/version | grep -iE 'cache-control|pragma|expires'
cache-control: no-cache, no-store, must-revalidate
pragma: no-cache
$ echo $CONSOLE_URL
https://console-openshift-console.apps.jeramos-1333.ci-psi.rhocf-dev.net |
|
/verified by Jefferson Ramos |
|
@jrangelramos: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/retest |
|
@jrangelramos: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
no-cache, no-store, must-revalidate+Pragma: no-cache) by default on all responses viaWithSecurityHeaderspublic, max-age=31536000, immutable) for content-hashed static assets under/static/via newWithStaticCacheHeadersWithSecurityHeaderswrap on the static handler (the outer mux-level middleware already covers it)Test plan
go build ./cmd/bridge/...compiles cleanlygo test ./pkg/middleware/...— 3 new tests pass:TestWithSecurityHeaders— all 6 headers (4 existing + 2 new)TestWithStaticCacheHeaders— static handler overrides restrictive defaultsTestNonStaticEndpointHasNoCacheHeaders— API endpoints getno-storeindex.htmlgetsno-store,/static/bundles getmax-age=31536000🤖 Generated with Claude Code
Summary by CodeRabbit