Caramelize the onions slowly over medium-low heat until deeply golden, then set aside. Build a roux with butter, shallot, and flour, cooking until lightly blonde. Whisk in broth and cream, simmer gently, add herbs, and melt in the Parmesan until smooth.
Layer sliced potatoes, cream sauce, and caramelized onions in a buttered baking dish. Cover and bake at 375°F until tender, then uncover and bake until bubbling and lightly golden. Rest before serving.