magento2 – Magento 2 not able to read the query parameters passed to category page on live server

I am trying to read the GTM parameters passed on page before page is redirected to external resource for authentication. I can read this query parameters on local server but on production server it gives me null value. Below is my code.

I want to get above url as it is before redirected to external resource for authentication.

$request = $observer->getEvent()->getRequest();
        $pageUrl = $this->_urlInterface->getCurrentUrl();
        $currentCategoryUrl = $this->_storeManager->getStore()->getCurrentUrl(false);
        $this->logMessage("current url from observer: ".$currentCategoryUrl);
        $params = json_encode($this->request->getParams());
        $this->logMessage("rquest param from observer: ".$params);
        $this->logMessage("page url from observer: ".$pageUrl);
        if(isset($_SERVER('HTTP_REFERER'))) {
            $refUrl = $_SERVER('HTTP_REFERER');
           $refUrl = $pageUrl;
        $this->logMessage("referal url from observer: ".$refUrl);
        $signInStatus = $this->_customerSession->isLoggedIn();
        if((!$signInStatus)) {
               $redirectURI = $this->_helper->getSignInRedirect();
               header("Location: $redirectURI");
        else {

I tried this code on local and it is working fine, $this->_urlInterface->getCurrentUrl(); $params = json_encode($this->request->getParams()); $_SERVER('HTTP_REFERER') this all methods give me the query parameters passed with url on local server but not works on production server.

Any help appreciated.