Warm the oven to 400°F (205°C). Coat an 8x8-inch baking dish with nonstick spray.
Layer the potato slices and onion rings in the dish, alternating between potato and onion.
In a medium saucepan over medium heat, melt the butter. Whisk in the flour and salt, and keep stirring for one minute. Pour in the milk and continue cooking until the mixture thickens.
Add the cheese all at once, stirring until it's fully melted and smooth, about 30 to 60 seconds.
Pour the cheese sauce evenly over the potato-onion layers, then cover the dish with aluminum foil.
Bake for 85 to 90 minutes, or until the potatoes are fork-tender.
If you want a browned top, switch the oven to broil after baking and cook until the surface turns golden.
Adjust seasoning with salt and pepper, then serve.