01 -
Preheat oven to 400°F. Lightly grease an 8x8-inch casserole dish with nonstick cooking spray.
02 -
Arrange alternating layers of sliced potatoes and onions in the prepared baking dish.
03 -
In a medium saucepan over medium heat, melt the butter. Add the flour and kosher salt, whisking constantly for 1 minute.
04 -
Gradually pour in the whole milk while whisking, cooking until the mixture thickens. Stir in the shredded cheddar cheese all at once and mix until completely melted and smooth, about 30 to 60 seconds.
05 -
Pour the hot cheese sauce evenly over the potato and onion layers. Cover the baking dish tightly with aluminum foil.
06 -
Bake for 85 to 90 minutes, or until the potatoes are tender when pierced with a fork.
07 -
Optional: Set oven to broil and remove the foil. Broil for several minutes until the top is golden brown.
08 -
Remove from oven, season with additional salt and black pepper as desired, and serve hot.