The characteristics of cavity-based supersonic flow and combustion in a scramjet combustor are investigated both experimentally and numerically. Cavities with depth D = 8 mm, length-to-depth ratio L/D = 4 or 7 and aft angle A = 22.5, 45 or 90° are considered. In non-reacting flows, the cavity shear layer dives deeper into the cavity with decreasing aft angle, resulting in a more intense impingement of the shear layer on the aft wall and a stronger trailing edge shock but weaker oscillations within the cavity as well as a smaller penetration of the upstream-injected hydrogen jet. The cavity with larger aft angle is beneficial to promote the instabilities evolving in the jet-mixing layer and accelerate the breakdown of the counter-rotating vortices, resulting in more rapid fuel–air mixing. In reacting flows, the cavity with larger aft angle also exhibits stronger oscillations and higher combustion efficiency with no greater total pressure loss. The results indicate that cavities with larger aft angle may be more beneficial to enhance the supersonic mixing and combustion as long as the oscillations are not too violent to induce blowout or blowoff of the cavity-stabilized combustion.