0

Let's say we have Varnish configured with Apache as a backend.

For some odd reasons, some clients send custom HTTP headers that are badly formed because they have a space before the header's colon (eg. "X-CUSTOM : value"), causing a 400 bad request on Apache.

Is it possible to deal with it on the Varnish side to sanitize headers, removing the extra space before the colon?

If you know another tool than Varnish that can easily do this job it's ok for me too.

gr0bz
  • 189
  • 1
  • 2
  • 11

1 Answers1

0

Varnish will work.

It will simply discard the "invalid" header and the requests will proceed as normal further.

So simply putting Varnish in front of Apache will allow you to fix the requests which would otherwise result in 400.

I've confirmed this with Varnish 4.1. I wouldn't be 100% confident that other versions have the same behaviour.

Danila Vershinin
  • 8,725
  • 2
  • 29
  • 35
  • Thanks for your reply, but discard those headers is not an option for me because they are used in the final application. I realy want to trim this extra space in the header's name. – gr0bz Mar 16 '17 at 08:45