2. If the real number $a$ makes the inequality $\frac{1}{1+\sqrt{x}}$ $\geqslant a \sqrt{\frac{\sqrt{x}}{x-1}}$ always have non-zero real solutions for $x$, then the range of values for $a$ is ( ).
(A) $(-\infty,+\infty)$
(B) $(-\infty, \sqrt{2}]$
(C) $\left(-\infty, \frac{\sqrt{2}}{2}\right]$
(D) $(-\infty, \sqrt{2}-1]$
2. D.

If $a \leqslant 0$, then the inequality always has a non-zero solution.
If $a>0$, let $t=\sqrt{x}$. Then $x=t^{2}(t>1)$.
Thus, the original inequality becomes $\frac{1}{1+t} \geqslant \frac{a \sqrt{t}}{\sqrt{t^{2}-1}}$, which is
$$
a^{2} \leqslant \frac{t-1}{t(t+1)} \text {. }
$$

Let $s=t-1(s>0)$. From equation (1), we get
$$
\begin{array}{l}
a^{2} \leqslant \frac{s}{(s+1)(s+2)}=\frac{1}{3+\left(s+\frac{2}{s}\right)} \\
\leqslant \frac{1}{3+2 \sqrt{s \cdot \frac{2}{s}}}=\frac{1}{3+2 \sqrt{2}}=\frac{1}{(1+\sqrt{2})^{2}} .
\end{array}
$$

Therefore, $0<a \leqslant \frac{1}{1+\sqrt{2}}=-1+\sqrt{2}$.
The equality holds if and only if $s=\sqrt{2}$.
In summary, the range of $a$ is $a \leqslant \sqrt{2}-1$.