diff --git a/lib/cors-anywhere.js b/lib/cors-anywhere.js index 682ac58..5890a71 100644 --- a/lib/cors-anywhere.js +++ b/lib/cors-anywhere.js @@ -182,6 +182,9 @@ var getHandler = exports.getHandler = function(options) { delete req.headers[header]; }); + // Only add port if it was explicitly set + req.headers.host = host + (match[4] ? ':' + port : ''); + proxyRequest(req, res, proxy, full_url, { host: hostname, port: port @@ -197,7 +200,6 @@ var createServer = exports.createServer = function(options) { // Default options: var httpProxyOptions = { - changeOrigin: true, // Change Host request header to match the requested URL instead of the proxy's URL. xforward: { enable: true // Append X-Forwarded-* headers } diff --git a/package.json b/package.json index 3e8be3d..bba5d12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cors-anywhere", - "version": "0.1.1", + "version": "0.1.2", "description": "CORS Anywhere is a reverse proxy which adds CORS headers to the proxied request. Request URL is taken from the path", "license": "MIT", "author": "Rob W ",