Here is the back of my headboard, in my scary garage. Don’t judge. Anyway, I added some spare 1×3 to the top to give the headboard a uniform thickness, since there would be 1×3 going up each side for the legs. That space right there between the edge of the 1×3 and the edge of the plywood is for the leg.
Photo Credit: Woodlawn Lane