  We study the Hardy inequality when the singularity is placed on the boundary
of a bounded domain in $\mathbb{R}^n$ that satisfies both an interior and
exterior ball condition at the singularity. We obtain the sharp Hardy constant
$n^2/4$ in case the exterior ball is large enough and show the necessity of the
large exterior ball condition. We improve Hardy inequality with the best
constant by adding a sharp Sobolev term. We next produce criteria that lead to
characterizing maximal potentials that improve Hardy inequality. Breaking the
criteria one produces successive improvements with sharp constants. Our
approach goes through in less regular domains, like cones. In the case of a
cone, contrary to the smooth case, the Sobolev constant does depend on the
opening of the cone.

Analysis of PDEs