Improves handling of forwarded headers. Fix #2094