OCPBUGS-70112: Add Cache-Control headers to console responses - #16923
Conversation
|
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe middleware adds no-cache headers for non-static responses and immutable public caching for static assets. The ChangesCache Header Behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 13 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (13 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 |
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>
6563a5b to
0d8f8c7
Compare
|
@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. |
|
/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. |
|
@jrangelramos verified the cache headers on a live cluster ( Test:
One note.... the OpenShift router (HAProxy) appends a second LGTM 👍 /lgtm |
|
@jhadvig: 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. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhadvig, jrangelramos The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Scheduling tests matching the |
|
@jrangelramos: all tests passed! 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. |
|
@jrangelramos: Jira Issue OCPBUGS-70112: Some pull requests linked via external trackers have merged: The following pull request, linked via external tracker, has not merged:
All associated pull requests must be merged or unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with Jira Issue OCPBUGS-70112 has not been moved to the MODIFIED state. This PR is marked as verified. If the remaining PRs listed above are marked as verified before merging, the issue will automatically be moved to VERIFIED after all of the changes from the PRs are available in an accepted nightly payload. 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. |
|
/cherry-pick release-4.23 |
|
@jrangelramos: new pull request created: #16959 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 kubernetes-sigs/prow repository. |
|
@jrangelramos: new pull request created: #16960 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 kubernetes-sigs/prow repository. |
|
@jrangelramos: new pull request could not be created: failed to create pull request against openshift/console#release-4.23 from head openshift-cherrypick-robot:cherry-pick-16923-to-release-4.23: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"No commits between openshift:release-4.23 and openshift-cherrypick-robot:cherry-pick-16923-to-release-4.23"}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"} 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 kubernetes-sigs/prow repository. |
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