I want to reject requests that contain double headers with different values and therefore could lead to problems. But im unsure on how to check via .htaccess if a header is present more than once.
For example if a header named "x-test-header" with different values is present two times then return a 400. If the "x-test-header" headers contains the same value then it can be passed through. The "x-test-header" should also be allowed to contain comma separted values like "abc, xyz". So something like "xyz, abc" should be valid aswell.
I can't really think of a way to check if a heading occurs multiple times and how to check the values of those. Also, I'm not sure how to access comma separated values and process them cleanly. Is that even possible?
Using Apache 2.4.52
Edit:
List of examples that should be valid:
1.
x-test-header: abc, xyz
x-test-header: xyz, abc
x-test-header: abc
x-test-header: abc
List of examples that should be rejected:
3.
x-test-header: abc, xyz
x-test-header: abcd, xyz
x-test-header: abc
x-test-header: xyz