diff --git a/lib/http-proxy/passes/web-incoming.js b/lib/http-proxy/passes/web-incoming.js
index 7ae735514190eea569c605fff7d27c045fe8d601..07976f8eebea4ee2c51e57225657cfb3d0ff601e 100644
--- a/lib/http-proxy/passes/web-incoming.js
+++ b/lib/http-proxy/passes/web-incoming.js
@@ -56,7 +56,7 @@ module.exports = {
   },
 
   /**
-   * Sets `x-forwarded-*` headers if specified in config.
+   * Sets `x-forwarded-*` headers if specified in config and there's none.
    *
    * @param {ClientRequest} Req Request object
    * @param {IncomingMessage} Res Response object
@@ -76,10 +76,10 @@ module.exports = {
     };
 
     ['for', 'port', 'proto'].forEach(function(header) {
-      req.headers['x-forwarded-' + header] =
-        (req.headers['x-forwarded-' + header] || '') +
-        (req.headers['x-forwarded-' + header] ? ',' : '') +
-        values[header];
+      var headerName = 'x-forwarded-' + header;
+      if (!req.headers[headerName]) {
+          req.headers[headerName] = values[header];
+      }
     });
 
     req.headers['x-forwarded-host'] = req.headers['x-forwarded-host'] || req.headers['host'] || '';
diff --git a/lib/http-proxy/passes/ws-incoming.js b/lib/http-proxy/passes/ws-incoming.js
index 270f23f45db2b417a23d1d4331d2ecdf0d599a35..1a7e24f88181f9893144cb1cae513f13819c6cc1 100644
--- a/lib/http-proxy/passes/ws-incoming.js
+++ b/lib/http-proxy/passes/ws-incoming.js
@@ -59,10 +59,10 @@ module.exports = {
     };
 
     ['for', 'port', 'proto'].forEach(function(header) {
-      req.headers['x-forwarded-' + header] =
-        (req.headers['x-forwarded-' + header] || '') +
-        (req.headers['x-forwarded-' + header] ? ',' : '') +
-        values[header];
+      var headerName = 'x-forwarded-' + header;
+      if (!req.headers[headerName]) {
+          req.headers[headerName] = values[header];
+      }
     });
   },
 
diff --git a/package.json b/package.json
index 9fe81a26d6ae34771be1c39c10bf29a3d3332bad..9edd4a32a4613272df7f9e996dbcc95338217eee 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "http-proxy",
-  "version": "1.18.1",
+  "version": "1.18.2",
   "repository": {
     "type": "git",
     "url": "https://github.com/http-party/node-http-proxy.git"
diff --git a/test/lib-http-proxy-passes-web-incoming-test.js b/test/lib-http-proxy-passes-web-incoming-test.js
index f6553d30025a837005804e4219a1175575ea95ad..43bad81b8b7e6a43c561332d6717273812455bda 100644
--- a/test/lib-http-proxy-passes-web-incoming-test.js
+++ b/test/lib-http-proxy-passes-web-incoming-test.js
@@ -69,6 +69,27 @@ describe('lib/http-proxy/passes/web.js', function() {
       expect(stubRequest.headers['x-forwarded-port']).to.be('8080');
       expect(stubRequest.headers['x-forwarded-proto']).to.be('http');
     });
+
+    it('do not change the x-forwarded-* header values if already exist on req.headers', function () {
+      var stubRequest = {
+        connection: {
+          remoteAddress: '192.168.1.2',
+          remotePort: '8080'
+        },
+        headers: {
+          host: '192.168.1.2:8080',
+          'x-forwarded-host': '192.168.1.3:8081',
+          'x-forwarded-for': '192.168.1.3',
+          'x-forwarded-port': '8081',
+          'x-forwarded-proto': 'https'
+        }
+      };
+      webPasses.XHeaders(stubRequest, {}, { xfwd: true });
+      expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.3');
+      expect(stubRequest.headers['x-forwarded-port']).to.be('8081');
+      expect(stubRequest.headers['x-forwarded-proto']).to.be('https');
+      expect(stubRequest.headers['x-forwarded-host']).to.be('192.168.1.3:8081');
+    });
   });
 });
 
diff --git a/test/lib-http-proxy-passes-ws-incoming-test.js b/test/lib-http-proxy-passes-ws-incoming-test.js
index bfed888c0986c3233c609981091013dddf4ada74..f18e6d42f2166643e86e16ebcfdf20aee033c87a 100644
--- a/test/lib-http-proxy-passes-ws-incoming-test.js
+++ b/test/lib-http-proxy-passes-ws-incoming-test.js
@@ -9,7 +9,7 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
         method: 'DELETE',
         headers: {}
       },
-      stubSocket = { 
+      stubSocket = {
         destroy: function () {
           // Simulate Socket.destroy() method when call
           destroyCalled = true;
@@ -116,5 +116,27 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
       expect(stubRequest.headers['x-forwarded-port']).to.be('8181');
       expect(stubRequest.headers['x-forwarded-proto']).to.be('wss');
     });
+
+    it('do not change the x-forwarded-* header values if already exist on req.headers', function () {
+      var stubRequest = {
+        socket: {
+          remoteAddress: '192.168.1.3',
+          remotePort: '8181'
+        },
+        connection: {
+          pair: true
+        },
+        headers: {
+          host: '192.168.1.3:8181',
+          'x-forwarded-for': '192.168.1.2',
+          'x-forwarded-port': '8182',
+          'x-forwarded-proto': 'ws'
+        }
+      };
+      httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
+      expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
+      expect(stubRequest.headers['x-forwarded-port']).to.be('8182');
+      expect(stubRequest.headers['x-forwarded-proto']).to.be('ws');
+    });
   });
 });