TITLE: A morphism from proper to affine is constant?
QUESTION [6 upvotes]: Let $S$ be a base scheme and $f \colon X \to S$ and $Y \to S$ finitely presented  morphisms. Suppose that $g$ is affine and $f$ is faithfully flat and separated with connected reduced geometric fibers. Also, suppose that $f$ is proper over a (topologically) dense subscheme $U$ of $S$. Is it true that every morphism $g \colon X \to Y$ over $S$ is constant (i.e., factors through a section $S \to Y$)?

REPLY [2 votes]: This is essentially the proof of the rigidity theorem. As Brian says, it is enough to show that $O_S \rightarrow f_ {\ast}O_X$ is an isomorphism. If $p \in S$, then $\mathrm{H}^0(X_p, \mathcal{O}_{X_p}) = k(p)$, because the fibers are geometrically connected and geometrically reduced. Then by Grothendieck's base change theorem, $O_S \rightarrow f_ {\ast}O_X$ is in fact an isomorphism.
Edit: This does not answer Behrang's question, in view of his first comment (which should be really incorporated in the question).