For a keg system to pour beer without excessive foam, the system must be balanced, and the serving line/faucet free of obstructions. Serving beer at too high a pressure, or through a half-open faucet/tap agitates the beer, causing the foam you saw.
The system is balanced by having the pressure inside the keg set to just a touch more (0.5-1psi) than the pressure resistance outside the keg. The pressure resistance outside the keg comes from the beer line and the tap - the longer the beer line, the more resistance. Also any increase in height between the keg and the end of the tap will increase resistance.
But even if the system was originally balanced, with the right dispensing pressure or adequate length of beer line, there are still some things working against you:
if the keg has been sloshed about, some of the carbon dioxide will have come out of the beer and into the headspace, creating more pressure. It takes several days for this to equalize again.
as the keg warms, the pressure inside the keg increases, since gas has a higher pressure at higher temperature with the same volume.
If you have a keg that is overpressured, you have 3 basic options:
- reduce the pressure inside the keg by venting some of the gas. Some kegs have a pressure relief valve that can be pulled to reduce pressure. But do it in small bursts, and try the beer after each until you see that the beer comes out not to quickly.
- increase the resistance outside the keg by using a longer beer line and/or placing the keg somewhere low and serving the beer higher. (e.g. keg at ground level and stand up to serve the beer.)
- dispense a large amount beer to a large jug - removing beer from the keg will reduce the pressure in the keg, and keeping it in a jug gives time for the head on the beer to settle down. While you're waiting, just pour some more beer from the keg - this will come out slower and have less foam.
see