Scattering-type scanning near-field optical microscopy (s-SNOM) allows for nanoscale resolved Infrared (IR) and Terahertz (THz) imaging, and thus has manifold applications ranging from materials to biosciences. However, a quantitatively accurate understanding of image contrast formation at materials boundaries, and thus spatial resolution is a surprisingly unexplored terrain. Here we introduce the write/read head of a commercial hard disk drive (HDD) as a most suitable test sample for fundamental studies, given its well20 defined sharp material boundaries perpendicular to its ultra-smooth surface. We obtainunprecedented and unexpected insights into the s-SNOM image formation process, free of topography-induced artifacts that often mask and artificially modify the pure near-field optical contrast. Across metal-dielectric boundaries, we observe non-point-symmetric line profiles for both IR and THz illumination, which are fully corroborated by numericalsimulations. We explain our findings by a sample-dependent confinement and screening of the near fields at the tip apex, which will be of crucial importance for an accurate understanding and proper interpretation of high-resolution s-SNOM images of nanocomposite materials. We also demonstrate that with ultra-sharp tungsten tips the apparent width (and thus resolution) of sharp material boundaries can be reduced to about 5 nm.