It actually is quite possible, though it may require a kernel patch depending on your distrubution. There is the string
netfilter extension that let's you match specific packets based on if a string is contained within them. We have used it in the past for handling DDOS traffic.
An untested example is here:
# iptables -A INPUT -m string --string 'X-Forwarded-For: badIP' -j DROP
Keep in mind that this is a rather blunt instrument and can result in traffic being unexpectedly dropped- make sure you craft your rules carefully and explicitly. As EEAA stated as well, it will not work on encrypted traffic.
More information is here: https://www.netfilter.org/documentation/HOWTO/netfilter-extensions-HOWTO-3.html#ss3.18