feat(api): enhance trusted proxy handling (#1681)