diff --git a/lib/cors-anywhere.js b/lib/cors-anywhere.js index 8bc730f..cb1160b 100644 --- a/lib/cors-anywhere.js +++ b/lib/cors-anywhere.js @@ -77,11 +77,11 @@ function proxyRequest(req, res, proxy) { var location = req.corsAnywhereRequestState.location; req.url = location.path; - // Let the "Host" header be the host part of the path (including port, if specified). - req.headers.host = location.host; // Start proxying the request proxy.web(req, res, { + changeOrigin: true, + prependPath: false, target: location }); } diff --git a/package.json b/package.json index c2b3109..244376c 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ ], "main": "./lib/cors-anywhere.js", "dependencies": { - "http-proxy": "1.3.0" + "http-proxy": "1.11.1" }, "devDependencies": { "mocha": "~2.2.4", diff --git a/test/test.js b/test/test.js index 3e61774..7a59c63 100644 --- a/test/test.js +++ b/test/test.js @@ -390,8 +390,8 @@ describe('removeHeaders', function() { .set('cookie3', 'c') .expect('Access-Control-Allow-Origin', '*') .expectJSON({ - host: 'example.com', cookie3: 'c', + host: 'example.com', }, done); }); });