1
0
Fork 0
forked from svrjs/svrjs

Fixed bug with URLs beginning with multiple slashes being rewritten incorrectly.

This commit is contained in:
Dorian Niemiec 2024-02-11 21:26:26 +01:00
parent 5339f4c244
commit b829414f4c

2
svr.js
View file

@ -3332,7 +3332,7 @@ if (!cluster.isPrimary) {
if (typeof URL !== "undefined" && url.Url) {
try {
// Create a new URL object using the provided URI and base URL
var uobject = new URL(uri, "http" + (req.socket.encrypted ? "s" : "") + "://" + (req.headers.host ? req.headers.host : (domain ? domain : "unknown.invalid")));
var uobject = new URL(uri.replace(/^\/{2,}/,"/"), "http" + (req.socket.encrypted ? "s" : "") + "://" + (req.headers.host ? req.headers.host : (domain ? domain : "unknown.invalid")));
// Create a new URL object (similar to deprecated url.Url)
var nuobject = new url.Url();