Set Host header based on actual input

Fixes #1
This commit is contained in:
Rob Wu
2013-03-30 17:39:25 +01:00
parent ac0cced2f5
commit 59d5bc6043
2 changed files with 4 additions and 2 deletions

View File

@@ -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
}

View File

@@ -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 <gwnRob@gmail.com>",