Hi all,
I already posted this question on stack overflow, but I think, that here I can find interested people faster.
I need to add specific header on swagger ui using .net core. Is there any way to include header like this?
Already tried:
- implementing IOperationFilter:
public void Apply(Operation operation, OperationFilterContext context)
{
if (operation.Parameters == null)
operation.Parameters = new List<IParameter>();
if (operation.Parameters.All(p => p.Name != "Proxy-Authorization"))
{
operation.Parameters.Add(new NonBodyParameter
{
Name = "Proxy-Authorization",
In = "header",
Description = "Proxy-Authorization token",
Required = true,
Type = "string"
});
}
}
- adding security definition:
options.AddSecurityDefinition("Authorization", new ApiKeyScheme()
{
In = "header",
Description = "Please insert Proxy Authorization Secret into field",
Name = "Proxy-Authorization",
Type = "apiKey"
});
Both didn't work. When I change header name everything works fine (HttpContext.Request.Headers
contains desirable header), but this specific ( Proxy-Authorization
) header is wiped out from a call.
Did you ever meet this issue? How to solve it?
EDIT:
I confirmed that this is not the issue in .net core only. Full .net framework has also this bug.
Furthermore it is only affected on header with proxy-
prefix.
Top comments (3)
I confirmed that this is not the issue in .net core only superfighters
If anyone is interested in this topic, please find my repository presenting this issue in full .net framework.
I always wonder what is proxy authorization
happy wheels