Move the common code handling proxy/auth metadata statements in a single function