replaced old symlink logic with tested middlewear based on fs.realpath