connect-modrewrite
Advanced tools
Comparing version 0.6.2-pre to 0.6.3-pre
@@ -12,4 +12,6 @@ | ||
app.use(modRewrite([ | ||
'/proxy/(.*) http://nodejs.org/$1 [P]' | ||
'/proxy/(.*) http://nodejs.org/$1 [P]', | ||
'!\\.\\w+$ /index.html' | ||
])); | ||
app.use(express.static(__dirname)); | ||
}); | ||
@@ -16,0 +18,0 @@ |
15
index.js
@@ -157,4 +157,7 @@ | ||
var pipe = request(opts, function (res) { | ||
pipe._headers.via = opts.headers.via; | ||
res.headers.via = opts.headers.via; | ||
metas.res.writeHead(res.statusCode, res.headers); | ||
res.on('error', function (err) { | ||
metas.next(err); | ||
}); | ||
res.pipe(metas.res); | ||
@@ -167,3 +170,7 @@ }); | ||
pipe.end(); | ||
if(!metas.req.readable) { | ||
pipe.end(); | ||
} else { | ||
metas.req.pipe(pipe); | ||
} | ||
} | ||
@@ -181,3 +188,3 @@ | ||
function _getRequestOpts(req, rule) { | ||
var opts = url.parse(req.url.replace(rule.regexp, rule.replace)) | ||
var opts = url.parse(req.url.replace(rule.regexp, rule.replace), true) | ||
, query = (opts.search != null) ? opts.search : ''; | ||
@@ -196,3 +203,5 @@ | ||
delete opts.headers['host']; | ||
return opts; | ||
} |
{ | ||
"name": "connect-modrewrite", | ||
"main": "./index.js", | ||
"version": "0.6.2-pre", | ||
"version": "0.6.3-pre", | ||
"description": "connect-modrewrite adds modrewrite functionality to connect/express server", | ||
@@ -6,0 +6,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20660
12
528