Melt butter in a heavy pot or Dutch oven over medium heat. Add sliced onions and ½ teaspoon salt.
Cover and cook gently for about 5 minutes to soften.
Remove the lid and continue cooking, stirring occasionally, until onions turn golden brown and deeply caramelized (30-45 minutes). Adjust heat as needed.
Once onions are caramelized, stir in the white wine and bring the mixture to a boil.
Sprinkle in the flour, stirring continuously, and let cook for 1-2 minutes to thicken.
Slowly pour hot broth into the onion mixture. Season with ¼ teaspoon salt and black pepper. Simmer uncovered for about 10 minutes, adjusting seasonings to taste.
Preheat your broiler. Ladle soup into ovenproof bowls placed on a baking tray.
Top each bowl generously with bread slices, then sprinkle with plenty of grated Gruyère cheese.
Broil for 1-2 minutes until cheese is bubbly and golden. Serve immediately and enjoy!