From 6ea512e7ecdafa3107897f26907f9e211aa8323d Mon Sep 17 00:00:00 2001
From: Zachary Carter <zack.carter@gmail.com>
Date: Wed, 23 May 2012 16:38:20 -0700
Subject: [PATCH] Copy necessary headers when forwarding

---
 lib/http_forward.js | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/http_forward.js b/lib/http_forward.js
index d9408f997..d8d9681f5 100644
--- a/lib/http_forward.js
+++ b/lib/http_forward.js
@@ -55,6 +55,18 @@ exports.forward = function(dest, req, res, cb) {
     if (pres.headers.hasOwnProperty('set-cookie')) {
       res.setHeader('Set-Cookie', pres.headers['set-cookie']);
     }
+    if (pres.headers.hasOwnProperty('vary')) {
+      res.setHeader('Vary', pres.headers['vary']);
+    }
+    if (pres.headers.hasOwnProperty('cache-control')) {
+      res.setHeader('Cache-Control', pres.headers['cache-control']);
+    }
+    if (pres.headers.hasOwnProperty('etag')) {
+      res.setHeader('ETag', pres.headers['etag']);
+    }
+    if (pres.headers.hasOwnProperty('x-frame-options')) {
+      res.setHeader('X-Frame-Options', pres.headers['x-frame-options']);
+    }
     pres.on('data', function (chunk) {
       res.write(chunk);
     }).on('end', function() {
@@ -87,6 +99,9 @@ exports.forward = function(dest, req, res, cb) {
   if (req.headers['accept-language']) {
     preq.setHeader('Accept-Language', req.headers['accept-language']);
   }
+  if (req.headers['if-none-match']) {
+    preq.setHeader('If-None-Match', req.headers['if-none-match']);
+  }
 
   // if the body has already been parsed, we'll write it
   if (req.body) {
-- 
GitLab