KB Article #183056

Header not added due to "invalid value syntax"

Problem

You receive an error similar to the following:

DEBUG    2000-01-01T00:00:00.000Z    run filter [Add HTTP Header] {
ERROR    2000-01-01T00:00:00.000Z    Header 'Your_Header' not added: invalid value syntax.
DEBUG    2000-01-01T00:00:00.000Z    } = 0, filter [Add HTTP Header]

Resolution

This means that the value assigned to the header in your Add HTTP Header filter is invalid according to the grammar in RFC 7230, Section 3.2. In general, to resolve this, you should ensure that the value does not contain any space, tab (\t), carriage return (\r) or line feed (\n) characters. You can remove those characters by using a String Replace filter on the attribute containing the value you want to insert in the header, to replace all matches of the regex character class [\r\n \t] with nothing. The space character inside that regex character class is both important and intentional, because it is intended to match any occurrence of those four whitespace characters.


If you must use a value with spacing following the obsolete obs-fold rule, you must both ensure that the value complies with the rules in RFC 7230 and set the com.vordel.dwe.outputObsFoldedValuesAllowed system property or you will see a Header 'Your_Header' not added: obs-folded value not allowed. error.