RIPRISTINARE L INDIRIZZO IP ORIGINALE DEL VISITATO


  1. Se non lo è già, abilitare sulla macchina il modulo Apache remoteip:

    Bash
    sudo a2enmod remoteip
    

  2. Aggiungere RemoteIPHeader CF-Connecting-IP al file di configurazione di Apache: Esempio su file: /etc/apache2/sites-available/sub.dominio.it-le-ssl.conf

    Bash
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ServerName remoteip.andy.support
    RemoteIPHeader CF-Connecting-IP
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    

  3. Se non è già stato fatto, sostituire tutti i %h con %a nei file di configurazione di Apache /etc/apache2/apache2.conf: Da:

    Bash
    LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
    
    A:
    Bash
    LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
    

  4. Se non è già stato creato, generare il file /etc/apache2/conf-available/remoteip.conf e inserire:

    Bash
    RemoteIPHeader CF-Connecting-IP
    RemoteIPTrustedProxy 127.0.0.1
    

  5. Abilitare il file di configurazione remoteip.conf:

    Bash
    sudo a2enconf remoteip
    

  6. Testare la configurazione di Apache:

    Bash
    sudo apache2ctl configtest
    

SOLO SE IL TEST HA AVUTO SUCCESSO Syntax OK, riavviare Apache:

Bash
sudo systemctl restart apache2


FONTE: https://developers.cloudflare.com/support/troubleshooting/restoring-visitor-ips/restoring-original-visitor-ips/