wso2 / product-microgateway

Choreo Connect is a cloud-native, open-source, and developer-centric API gateway.
https://wso2.com/choreo/choreo-connect/
Apache License 2.0
293 stars 252 forks source link

Add prefixes for every headers and trailers #3529

Open chashikajw opened 4 months ago

chashikajw commented 4 months ago

Purpose

This will fix the custom property override issue when the header name is defined in both the request and response arrays.

From this fix it will add REQUEST_HEADER_, RESPONSE_HEADER_and RESPONSE_TRAILER_ prefixes for particular headers.

[analytics.adapter.customProperties]
    enabled = true
    requestHeaders = ["host","content-type","content-length", "authorization","x-forwarded-for","x-original-forwarded-for","x-client-dn", ":path", ":authority"]
    responseHeaders = ["etag", "content-type"]

customer property array will be like below.

 [REQUEST_HEADER_content-type=text/json, REQUEST_HEADER_:path=/v2/pet/findByStatus?status=available, REQUEST_HEADER_host=petstore.swagger.io, REQUEST_HEADER_:authority=petstore.swagger.io, RESPONSE_HEADER_content-type=application/json, host=petstore.swagger.io, content-type=application/json, :path=/v2/pet/findByStatus?status=available, :authority=petstore.swagger.io]

This will not remove the previous headers to keep the backword compatibility.

Fixes