Preheat the oven to 200˚C. Grease a 20cm flan tin or quiche dish.
On a lightly floured board roll out pastry or use ready-rolled sheet. Use to line the dish. Trim excess pastry off and discard. Bake blind for 12 minutes.
To make the filling melt butter in a saucepan. Add bacon and onion. Cook until the onion is clear. Stir in flour and cook until frothy. Gradually add milk, stirring constantly until mixture boils and thickens. Remove pan from heat.
Add cheese to the saucepan and mix to combine. Season with salt and pepper to taste. Lightly beat eggs with a fork and stir in.
Remove baking blind material. Return to the oven for 1 minute to dry pastry out.
Remove from oven. Pour filling into the pastry base.
Return to oven and bake for a further 30 minutes or until filling is golden and set. Serve hot or cold.