Sha256: 99f62e15ea9297cb3269d01d6c21036f2d0915947896786cccce2eaca70f942b
Contents?: true
Size: 537 Bytes
Versions: 17
Compression:
Stored size: 537 Bytes
Contents
/** * Strip host middleware is responsible for stripping hostname from request path * This to handle requests that uses (normally over proxies) an absolutURI as request path */ var createStripHostMiddleware = function() { return function(request, response, next) { function stripHostFromUrl(url) { return url.replace(/^http[s]?:\/\/([a-z\-\.\:\d]+)\//, '/'); } request.normalizedUrl = stripHostFromUrl(request.url) || request.url; next(); }; }; // PUBLIC API exports.create = createStripHostMiddleware;
Version data entries
17 entries across 17 versions & 2 rubygems