Preheat the oven to 500 degrees. Rinse chicken, and pat dry with paper towels. Season inside with salt and pepper. Slice 2 onions crosswise into 1/4-inch-thick rings. Place in a single layer in a roasting pan, about 13-by-16 inches. Slice 1 lemon into 1/4-inch-thick rings, and place on top of onions. Cut remaining onion and lemon into wedges, and stuff into cavity of chicken. Tie legs together with kitchen twine, and place on bed of onions and lemon. Brush with melted butter, and cook, basting occasionally, until an instant-read thermometer inserted in the thickest part of the thigh reads 165 degrees, 50 minutes to 1 hour. Cover with foil if skin gets too brown. Transfer chicken to platter or cutting board to rest while making gravy.
Place pan with onions and drippings over medium heat. Sprinkle with flour, and stir constantly until well combined. Add chicken stock, and cook, stirring occasionally, until gravy thickens, about 3 minutes. Strain, discarding solids, and season with salt and pepper. Serve hot over chicken.