The simplest way I found is it that includes host/path/query and
works in Controllers
(Cakephp 3.4
):
Cake\View\Helper\UrlHelper::build($this->request->getRequestTarget());
which returns something like this (we use it as login callback url) :
http://192.168.0.57/archive?melkId=12