Skip to content

Add support for excluding sensitive headers from Feign logging - #1458

Open
yashdotdev13 wants to merge 1 commit into
spring-cloud:mainfrom
yashdotdev13:feat/1344-sensitive-header-logging
Open

yashdotdev13 wants to merge 1 commit into
spring-cloud:mainfrom
yashdotdev13:feat/1344-sensitive-header-logging

Conversation

@yashdotdev13

Copy link
Copy Markdown
Contributor

Summary

Adds support for configuring sensitive HTTP headers that should be excluded from Feign request and response logging.

Closes #1344

Changes

  • Introduced logging.sensitive-headers under per-client Feign configuration.
  • Added case-insensitive filtering for request and response headers.
  • Supports both default and client-specific sensitive header configurations.
  • Combines default sensitive headers with client-specific entries.
  • Preserves existing custom Logger and FeignLoggerFactory behavior.
  • Added configuration metadata and documentation.
  • Added tests covering case-insensitive filtering, default configuration, and client-specific configuration.

Configuration Example

spring:
  cloud:
    openfeign:
      client:
        config:
          default:
            logging:
              sensitive-headers:
                - Authorization
                - Cookie
          inventoryClient:
            logging:
              sensitive-headers:
                - X-API-Key

Testing

  • FeignLoggerFactoryTests — 6 tests passed.
  • spring-javaformat:validate — passed.
  • git diff --check — passed.

Note: This configuration excludes headers from Feign logging; it does not redact sensitive information in request or response bodies.

Signed-off-by: 98001yash <yashchauhan.gaya@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow configuring shouldLogRequestHeader/shouldLogResponseHeader

2 participants