added bool flag to use req.url instead of the fully qualified path