Yeah, very weird indeed. Unfortunately, your hack for Varnish 3 doesn't work on 4, because in Varnish 4 `req` is unavailable in `vcl_miss`.