1. A method comprising: in a network comprising a plurality of network nodes each configured to apply one or more service functions to traffic that passes through the respective network nodes, receiving at a network node packets encapsulated in a service header that includes a first set of context headers with metadata that is relevant to one or more service functions within a service path comprised of one or more network nodes; at the network node, interpreting a forwarding state and a next-hop network node for the service path from the service header, and determining a service action or associated metadata from the first set of context headers; and rewriting the service header with a second set of context headers.