Trim the top ¼ inch off the top of the garlic bulb.
Place the heads of garlic onto a piece of tin foil and drizzle with olive oil, and sprinkle with salt.
Tightly wrap the garlic in the foil.
Roast in the oven for 40 to 60 minutes.
When cool to touch, remove the garlic cloves from the skin and set aside. You can squeeze the cloves out or simply peel the skin off. Set aside.
For the Caramelized Onions
Add the onions and sauté for 5 minutes or until the onions have softened.
Add the salt, if using, and reduce the heat to medium low and cook for 50 to 60 minutes. Stir the onions with a wooden spoon or spatula every few minutes, or until the onions are golden brown, and caramelized.
For the Potatoes au Gratin
In a small pot on medium low heat, melt the butter before adding the flour, bit by bit, and stir until evenly combined. Cook for a minute.
Slowly pour in the chicken broth and whisk until combined.
Slowly add in the milk, and whisk until combined.
Add the salt, pepper, and fresh herbs and allow fresh herbs to infuse for 2-3 minutes on low heat, stirring constantly. Do not let it come to a boil. Remove from heat and remove fresh herbs before setting aside.
Spray a 9×9 or 9×13 baking dish with non-stick spray.
Spread half of the sliced potatoes in an even layer on the bottom of the pan and top evenly with the caramelized onions, roasted garlic, and half of the béchamel sauce. Top with half of the cheese.
Layer the rest of the sliced potatoes on top before adding the rest of the béchamel sauce and cheese.
Cover with tin foil and bake for bake for 45 minutes. Remove the tinfoil and bake for another 30 minutes, or until the potatoes are cooked through.
Let rest for 15 minutes before slicing and serving. Top with some fresh thyme if desired.
You can mash the roasted garlic into a paste and mix it into the béchamel sauce.