4. If a vertex of an ellipse is symmetric to one of its foci with respect to the directrix, then the eccentricity of the ellipse is $e=$ $\qquad$ .
4. $\frac{1}{2}$ or $\frac{\sqrt{2}}{2}$.

Establish a Cartesian coordinate system, and let the equation of the ellipse be $\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}=1(a>b>0)$.
Then the vertices are $A_{1,2}=( \pm a, 0), B_{1,2}=(0, \pm b)$, and the foci are $F_{1,2}=( \pm c, 0)$,
with the directrix equations $l_{1,2}: x= \pm \frac{a^{2}}{c}\left(c=\sqrt{a^{2}-b^{2}}\right)$.
By symmetry, we only need to consider two cases:
(1) The point $A_{1}(-a, 0)$ is symmetric to $F_{2}(c, 0)$ and lies on the right directrix $x=\frac{a^{2}}{c}$, by
$$
-a+\frac{a^{2}}{c}=2 c \Rightarrow e=\frac{c}{a}=\frac{1}{2} ;
$$
(2) The point $B_{1}(0, b)$ is symmetric to $F_{2}(c, 0)$ and lies on the right directrix $x=\frac{a^{2}}{c}$, by
$$
0+\frac{a^{2}}{c}=2 c \Rightarrow e=\frac{c}{a}=\frac{\sqrt{2}}{2} \text {. }
$$