I am trying to modify HTTP header for current URL. I want to set 410 status if current page header is 404. below code i used but i have created new controller so it always set 410 for that controller but i want to set for current url. $resultPage = $this->resultPageFactory->create(); $resultPage->setStatusHeader(410, '1.1', 'Gone'); $resultPage->setHeader('Status', '410 Gone'); return $resultPage; I am not sure which function used to set Http header. anyone has idea?