Heat a large pot over medium heat. Add butter. Once melted, add the onions, shallots, and garlic. Stir together to combine. Add salt and pepper. Cook until onions have completely caramelized and softened and almost turned into a paste, about 45-60 minutes. Stir occasionally so the onions don't burn.
Preheat oven to 375 degrees. Slice baguette into ¼-inch slices. Place on a baking sheet and place into preheated oven. Bake for 6 minutes or until bread has toasted. Remove from oven and increase oven temperature to 450 degrees.
Once the onions are done, add the white wine and vinegar. Cook for 2 minutes. Add chicken broth and bay leaves. Bring soup to a boil and then reduce to a simmer and cook for 30 minutes.
Once the soup is done, remove the bay leaves and pour soup into oven-proof bowls. Top each bowl with 1-2 toasted baguette slices and a slice of Gruyere cheese. Place onto a rimmed baking sheet and place into oven. Bake until cheese melts and bubbles. Remove from oven and serve immediately.