magento-2-security
magento-2-security copied to clipboard
Get document root from server
Change extraction method
Description
In our server environment, the "Document Root" could not be read correctly.
Instead of reading the document root via "$this->request->getParam('DOCUMENT_ROOT')", the following command worked:
$this->request->getServer('DOCUMENT_ROOT')
This is also used by the Magento core:
https://github.com/magento/magento2/blob/c3ab314c5e51cb91c96f161d82db92370cd7d9b8/app/code/Magento/Sitemap/Model/Sitemap.php#L766
It is possible that other parameters are also affected:
REMOTE_ADDR HTTP_HOST SERVER_NAME