This is inspired from here. I will repeat some information from the linked question for the benefit of readers.
Let $k\in(0,1)$ and the elliptic integrals $K, E$ are defined as follows: $$K(k)=\int_{0}^{\pi/2}\frac{dx}{\sqrt{1 - k^{2}\sin^{2}x}},\,E(k)=\int_{0}^{\pi/2}\sqrt{1-k^{2}\sin^{2}x}\,dx\tag{1}$$ The number $k$ is called the modulus and a complementary modulus $k'$ is defined by $k'=\sqrt{1-k^{2}}$ and if the value of $k$ is available from context then the integrals $K(k), E(k), K(k'), E(k') $ are generally denoted by $K, E, K', E'$.
If $n$ is a positive rational number then it can be proved that there is a unique modulus $k$ such that $K'/K=\sqrt{n} $ and moreover this $k$ is an algebraic number. Such values of $k$ are famous and are called singular moduli and one may denote them by $k_{n} $ corresponding to the rational number $n$.
Chowla and Selberg proved in this paper that
Theorem: Let $k$ be a singular modulus. Then the elliptic integrals $K(k), E(k) $ can be expressed in terms of Gamma values at rational points and $\pi$.
The linked paper of Chowla and Selberg uses theory of quadratic forms and related complex analytic techniques to prove their theorem. On the other hand Ramanujan knew the evaluation of $K$ in terms of Gamma values and $\pi$ for some singular moduli $k$. In his classic paper Modular Equations and Approximations to $\pi$ he gave the evaluations for $n=1,2,3$ without proof. It is thus reasonable to assume that the evaluations are possible by remaining within the limits of real analysis methods at least for $n=1,2,3$. The case $n=1$ is covered in this answer.
My question concerns the cases $n=2,3$ for which $k=\tan(\pi/8),\sin(\pi/12)$ respectively:
Show that $$\int_{0}^{\pi/2}\frac{dx}{\sqrt{1-\tan^{2}(\pi/8)\sin^{2}x}}=\frac{\sqrt{\sqrt{2} +1} \Gamma (1/8)\Gamma (3/8)}{2^{13/4}\sqrt{\pi}}\tag{2}$$ and $$\int_{0}^{\pi/2}\frac{dx}{\sqrt{1-\sin^{2}(\pi/12)\sin^{2}x}}=\frac{3^{1/4}\Gamma ^{3}(1/3)}{2^{7/3}\pi}\tag{3}$$
Evaluation based on real analysis methods is desirable.
Update: I have managed to prove the above mentioned results using hints given in exercises from Borwein's Pi and the AGM (see my answer). But these methods are totally non-obvious and it is desirable to find solutions based on general techniques for evaluation of definite integrals.
Borwein's book was with me for a long time and these exercises lay dormant until I receieved a gentle push via user "Simply Beautiful Art"'s question linked above. Thanks to him for the same.