ashwinpankaj opened a new pull request, #23494: URL: https://github.com/apache/kafka/pull/23494
Fixes [KAFKA-21113](https://issues.apache.org/jira/browse/KAFKA-21113): `RestServer.initializeResources()` builds a separate `ServletContextHandler adminContext` whenever `admin.listeners` is configured to a distinct value, but `configureHttpResponseHeaderFilter` was only ever called on the regular context. `response.http.headers.config` is commonly used for security-hardening headers (the existing test suite itself uses `X-XSS-Protection`, `Cache-Control`, and references `X-Frame-Options`), so these were silently missing from all admin endpoint responses whenever a distinct admin listener was configured. This is the same "regular-only, admin left out" bug shape already fixed for REST extension registration in #23150. Fix: call `configureHttpResponseHeaderFilter(adminContext, headerConfig)` too, guarded on `adminContext != null`, mirroring the guard already used elsewhere in the same method (`adminContext.start()`, extension registration). Added `testCustomizedHttpResponseHeadersAppliedToAdminContext` asserting the configured headers appear on `server.adminUrl()` responses. Also includes a small, related test fix raised in review on #23150: [this comment](https://github.com/apache/kafka/pull/23150#discussion_r3880635478) pointed out that `testRestExtensionsWithoutAdminListener` only checked `/connectors` via `advertisedUrl()`, not `/admin/loggers`, even though in the no-separate-admin-listener case admin resources fall back to sharing the regular `ResourceConfig` and should be reachable the same way. Bundling it here since it's the same file and the same reviewer thread. ### Committer Checklist (excluded from commit message) - [x] Verify design and implementation - [x] Verify test coverage and CI build status - [x] Verify documentation (including upgrade notes) -- 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]
