Customs and immigration are usually required at the connecting airport for international flights. You don't always have to for domestic flights. In most cases, passengers on layover flights must clear customs and immigration at the first point of entry.