I have to run out now, so will write only the hint as of now. Later I might complete the details. Let me do one case here, the other one probably follows similarly.

Let $a \in (1/2,1)$, and write $a=1/2 + \epsilon$, for an appropriate $\epsilon$.

Now consider the function $1/f(x)$, which is (after some cleanup) seen to be

\begin{equation*}
\frac{2 e^{-2 (-1+x) x \left(\frac{1}{2}+\epsilon \right)^2} \left(e^{2 (-1+x) (-1+2 x) \left(\frac{1}{2}+\epsilon \right)^2} (1-2 \epsilon )+e^{2 x (-1+2 x) \left(\frac{1}{2}+\epsilon \right)^2} (1-2 \epsilon )+8 e^{(-1+x) x (1+2 \epsilon )^2} \epsilon \right)}{(1-2 \epsilon )^2}
\end{equation*}

But this is a nonnegative (since $2\epsilon < 1$) combination of convex functions of $x$ (because we have exponentials, products are ok), and is thus itself convex. Now, you can numerically or directly optimize this function and see that its minimum occurs at $x=0.5$, which implies that the maximum of your function occurs at $x=0.5$. (assuming it is easy to guarantee that $f(x)$ is a positive function).