Rational maps from $\mathbb CP^n$ to $\mathbb CP^{n-1}$, fixing $\mathbb CP^{n-1}$

Take $p_1,p_2,p_3,p_4\in\mathbb{P}^2$ general points and fix a line $L$ passing through $p_1$ but not containing $p_2,p_3,p_4$.

Take $x\in\mathbb{P}^2\setminus \{p_1,p_2,p_3,p_4\}$ and let $C_x$ be the conic through $p_1,p_2,p_3,p_4$ and $x$. Then $C_x$ intersects $L$ at $p_1$ plus another point $\tilde{x}$ which may coincide with $p_1$ if $C_x$ is tangent to $L$ at $p_1$.

So, you get a rational map $\pi:\mathbb{P}^2\dashrightarrow L\cong\mathbb{P}^1$ mapping $x\mapsto \tilde{x}$, which is not a linear projection. Note that $\pi$ fixes pointwise $L\setminus\{p_1\}$ and since $p_1\in L$ is a divisor on a smooth curve $\pi_{|L} = Id_{L}$.


With the additional restriction, $\varphi$ is indeed a linear projection.

Applying a linear change of coordinates, $H$ is given by $x_0=0$, so $\varphi$ is

$[x_0:\cdots:x_n]\mapsto [0:P_1(x_0,\ldots,x_n):\cdots: P_n(x_0,\ldots,x_n)]$

for some homogeneous polynomials $P_1,\ldots,P_n\in \mathbb{C}[x_0,\ldots,x_n]$ of the same degree $d$. You may choose them without common factor. Your assumption is that the restriction to $H$ is the identity. So this means that

$[0:x_1:\cdots:x_n]\mapsto [0:P_1(0,x_1,\ldots,x_n):\cdots: P_n(0,x_1,\ldots,x_n)]$ is the identity on $H$. Hence there is a polynomial $A\in \mathbb{C}[x_1,\ldots,x_n]$, homogeneous of degree $d-1$, such that $$P_i(0,x_1,\ldots,x_n)=A\cdot x_i$$ for $i=1,\ldots,n$.

The locus where $A=0$ and where $x_0=0$ is then contained in the intersection of the base-locus of $\varphi$ with $H$. As you assumed that this latter should be of codimension $2$ in $H$, it implies that $A$ is a non-zero constant. Hence, $d=1$, so $\varphi$ is of degree $1$ and is a linear projection.