Created
September 14, 2023 11:29
-
-
Save udovicic/30746ed5f745753451aad2bd908deb71 to your computer and use it in GitHub Desktop.
Magento 2 maintenance IPs when site is behind proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | |
<!-- ... --> | |
<!-- Inside di.xml, place the following --> | |
<!-- Restore original visitor IP from CloudFlare header --> | |
<type name="Magento\Framework\HTTP\PhpEnvironment\RemoteAddress"> | |
<arguments> | |
<argument name="alternativeHeaders" xsi:type="array"> | |
<item name="http_cf_connecting_ip" xsi:type="string">HTTP_CF_CONNECTING_IP</item> | |
</argument> | |
</arguments> | |
</type> | |
<!-- ... --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment