Exceptionless.Net icon indicating copy to clipboard operation
Exceptionless.Net copied to clipboard

Add ability to collect custom HTTP Headers

Open jrt324 opened this issue 9 years ago • 1 comments

Asp.net WebApi Project using oAuth2 , the token info put in header: --header 'Authorization: Bearer 7f6b258211f24470b1384cd0614923df'

Current Exceptionless.WebAPI not record this header info

jrt324 avatar Oct 28 '16 08:10 jrt324

@ejsmith @jrt324 I'm wondering if we should add a collection service just for collecting headers and by default it collects nothing. We get asked this quite a bit and I can't find the other two issues where I suggested adding a plugin with a priority of 91 or higher and update the existing RequestInfo based on this code for getting the headers: https://github.com/exceptionless/Exceptionless.Net/blob/master/src/Platforms/Exceptionless.Web/ExceptionlessWebPlugin.cs

@jrt324 if you'd like I can help you write this plugin, I'd recommend checking out our docs here on plugins: https://github.com/exceptionless/Exceptionless.Net/wiki/Adding-Plugins

niemyjski avatar Oct 28 '16 13:10 niemyjski

@ejsmith Any preference where stick the extra header values? Seems like maybe expanding on the RequestInfo model for headers or add it to the RequestInfo data bag. We get the request a lot to add additional headers or remove headers. I think data exclusions would be applied to headers and we would maybe exclude additional ones like Authorization headers??? Thoughts on doing this without adding a ton of weight to events.

niemyjski avatar Apr 12 '23 13:04 niemyjski

I am ok with adding headers to the RequestInfo. I think the object is pretty big already. We need to apply the same exclusions and yeah we should make sure it doesn't include the authorization header.

ejsmith avatar Apr 14 '23 13:04 ejsmith

Please note that we ignore the authorization headers by default and other header values that we already capture in the request info (e.g., user agent). If you want to capture authorization headers (not recommended), you'll need to add a plugin to add it to the request info headers.

niemyjski avatar Apr 25 '23 12:04 niemyjski

This is now deployed and available in the latest tagged server version.

niemyjski avatar Apr 25 '23 13:04 niemyjski