magento-2-security icon indicating copy to clipboard operation
magento-2-security copied to clipboard

Get document root from server

Open sfritzsche opened this issue 6 months ago • 0 comments

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

sfritzsche avatar Aug 06 '24 09:08 sfritzsche