Update Router generate() method. Check if the pattern url is external