Preheat the oven to 375°F. Grease a 9x13-inch baking dish. Set it aside.
Melt the butter in a large skillet or braising pan over medium heat.
Then, add the diced onions and sauté for 5-6 minutes, until the onions are soft and translucent.
Add the minced garlic to the pan and cook for an additional minute, stirring frequently to ensure the garlic does not burn.
Add the gluten-free flour and stir, cooking the flour, for 2-3 minutes until the roux has turned a golden brown color.
Reduce the heat to low. Combine the chicken broth and heavy cream in a measuring cup.
Slowly pour in the cream mixture into the roux, whisking as the mixture thickens.
Add the salt, pepper and nutmeg. Whisk to combine. Keep whisking until the cream sauce is smooth.
Bring the cream sauce to a low boil, and then remove from the heat. Set aside.
Place half of the sliced potatoes in an even layer slightly overlapping in the prepared 9x13-inch baking pan.
Spread half of the cream sauce in an even layer over the potatoes and then sprinkle half of the white cheddar cheese and parmesan cheese over the sauce.
Repeat with the remaining potatoes, cream sauce and cheeses.
Cover the pan with aluminum foil and bake at 375°F for 35 minutes. Remove the foil and continue baking for an additional 25 minutes until the top is golden, the potatoes are fork tender, and the sauce is bubbling.
Remove from the oven and let cool for at least 5 minutes before serving to let the sauce thicken up. Serve warm and enjoy!