spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

RemoveRequestHeaderIfnoExisted

Open PheaSoy opened this issue 1 year ago • 1 comments

RemoveRequestHeader if it doesn't exist in the config. I would like to allow my clients are connecting to my backend via SCG and only send the headers to downstream from available to the configuration, otherwise remove it from the request.

RemoveRequestHeaderGatewayFilter Using the RemoveRequestHeaderGatewayFilter is not ok, while the clients always send different key. All the key, that want to remove, it is consider to input or predefine in the config.

RemoveRequestHeaderIfNotExisted Possible, if we could have a filter to remove all headers if there are doesn't exist in the config. So it is allows SCG to control the minimum request header to send to downstream services which good and enhance some security reason.

  cloud:
    gateway:
      default-filters:
        #Remove All the sensitive request headers (Cookie, Set-Cookie & Authorization) while passing request to downstream services
        - RemoveRequestHeaderIfNotExisted=Cookie, Token, USER_ID, CHANNEL
     

PheaSoy avatar Aug 18 '24 11:08 PheaSoy

I'm not sure how many folks would want this. Marking for votes

spencergibb avatar Sep 27 '24 00:09 spencergibb

We can close this @spencergibb . I want to add my own use case to our internal SDK. Thank you.

PheaSoy avatar Oct 11 '25 14:10 PheaSoy