Skip to content

How to return a comma in a header using DownstreamHeaderTransform json-option? #2249

Answered by raman-m
flfaure-pro asked this question in Q&A
Discussion options

You must be logged in to vote

The comma is hard-coded as a delimiter in the HeaderFindAndReplaceCreator class, lines below 47:

foreach (var input in fileRoute.DownstreamHeaderTransform)
{
if (input.Value.Contains(","))

Ocelot has no options to specify custom delimiter. It needs to be developed. No such sub-feature.

To implement this solution using C#, you need to:

  • Override PreErrorResponderMiddleware using the Middleware Injection feature. In the response, locate the Cache-Control header with an invalid value and correct it.
  • Keep the escaped string in JSON: "Cache-Control": "public%2C max-age=1…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
4 replies
@flfaure-pro
Comment options

@raman-m
Comment options

@raman-m
Comment options

Answer selected by raman-m
@flfaure-pro
Comment options

Comment options

You must be logged in to vote
4 replies
@flfaure-pro
Comment options

@raman-m
Comment options

@flfaure-pro
Comment options

@raman-m
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Headers Transform Ocelot feature: Headers Transformation
2 participants