Skip to content

Instantly share code, notes, and snippets.

@b225ccc-zz
Created January 12, 2015 23:07
Show Gist options
  • Select an option

  • Save b225ccc-zz/2ee582a9b35ac5acddb3 to your computer and use it in GitHub Desktop.

Select an option

Save b225ccc-zz/2ee582a9b35ac5acddb3 to your computer and use it in GitHub Desktop.
LineRate snipper: URI trailing slash
'use strict';
var vsm = require('lrs/virtualServerModule');
var trailing_slash_re = /\/$/;
vsm.on('exist', 'vs_http', function (vs) {
console.log("Script ' + __scriptname +
' installed on Virtual Server ' +
vs.id + '");
vs.on('request', function (servReq, servResp, cliReq) {
if (trailing_slash_re.test(servReq.url) === false) {
servReq.url = servReq.url + '/';
}
cliReq();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment