Improves handling of forwarded headers. Fix #2094

Sorry, again, you've got tests that test this functionality in isolation, so no need to test it here.