For specific SEO requirements, I have added an X-Robots-Tag HTTP header via the .htaccess file on my server. However, I am facing an issue: I am unable to retrieve or read this header within Magento 2.
Here are the steps I have taken:
- Added the
X-Robots-Tagheader in the.htaccessfile. - Confirmed that the header is correctly set (visible through browser developer tools).
- Attempted to access this header in Magento 2. (getallheaders, getHeaders (with response class), $_SERVER …)
I am looking for advice or solutions on how to access the X-Robots-Tag header from within Magento 2. Is there a specific configuration required in Magento 2 or on the server to make this header accessible?
Thanks !