How does replica know which canister to serve from

Sorry, late repsonse, but it’s not the referrer. Eventually it will be the Host (canister-id.ic0.app); for local development a query parameter ?canister_id=abcde-fgh is used.