Preheat oven to 400 degrees F (200 degrees C). Lightly butter a 1-quart baking dish.
Layer half the potatoes into the bottom of prepared baking dish. Top with onion slices and add remaining potatoes.
Season potatoes with salt and pepper.
Melt butter over medium heat in a saucepan. Mix in flour and salt, stirring constantly with a whisk, for one minute. Stir in milk. Cook until mixture has thickened. Add Cheddar cheese and continue stirring until melted, 30 to 60 seconds.
Pour cheese sauce over potatoes and cover dish with aluminum foil.
Bake in the preheated oven until cheese sauce is bubbling and potatoes are tender, about 1 1/2 hours.