Enable mediawiki mobile frontend.
https://www.mediawiki.org/wiki/Extension:MobileFrontend
It's already installed. Works quite well. Imprint footer links now functional.
https://github.com/varnish/varnish-devicedetect could be the way to go.
https://www.mediawiki.org/wiki/Extension:MobileFrontend#Using_the_mobile_view contains some info on how to make MobileFrontend work with varnish.