forked from svrjs/svrjs
Fixed bug with URL rewriting and trailing slash redirection
This commit is contained in:
parent
33d89f01d3
commit
ab69abf2da
1 changed files with 3 additions and 3 deletions
4
svr.js
4
svr.js
|
@ -4316,7 +4316,7 @@ if (!cluster.isPrimary) {
|
|||
|
||||
// Trailing slash redirection
|
||||
function redirectTrailingSlashes(callback) {
|
||||
if (!disableTrailingSlashRedirects && href[href.length - 1] != "/") {
|
||||
if (!disableTrailingSlashRedirects && href[href.length - 1] != "/" && origHref[origHref.length - 1] != "/") {
|
||||
fs.stat("." + decodeURIComponent(href), function (err, stats) {
|
||||
if (err || !stats.isDirectory()) {
|
||||
try {
|
||||
|
@ -4328,7 +4328,7 @@ if (!cluster.isPrimary) {
|
|||
var destinationURL = uobject;
|
||||
destinationURL.path = null;
|
||||
destinationURL.href = null;
|
||||
destinationURL.pathname += "/";
|
||||
destinationURL.pathname = origHref + "/";
|
||||
destinationURL.hostname = null;
|
||||
destinationURL.host = null;
|
||||
destinationURL.port = null;
|
||||
|
|
Reference in a new issue