Use X-FORWARDED-* headers when contructing onlineresource (#4955)