Bug 34974 - В логи не пишется корректный адрес прокси-сервера
Summary: В логи не пишется корректный адрес прокси-сервера
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: apache2 (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: Anton Farygin
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-31 15:40 MSK by Vitaly Lipatov
Modified: 2018-10-25 05:26 MSK (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Lipatov 2018-05-31 15:40:45 MSK
Когда апач стоит за nginx, нужно использовать модуль remoteip:
# en2mod remoteip

вручную добавить файл с конфигом:
# cat /etc/httpd2/conf/extra-enabled/remoteip.conf 
<IfModule remoteip_module>
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 127.0.0.1/8
</IfModule>

и всё равно не поможет, потому что 
нужно заменить %h на %a в /etc/httpd2/conf/mods-available/log_config.conf
http://terraltech.com/preserving-remote-iphost-in-apache-2-4-access-log-files-while-proxying/

вот так:
diff --git a/httpd2/conf/mods-available/log_config.conf b/httpd2/conf/mods-available/log_config.conf
index ef70e2d..2d9052a 100644
--- a/httpd2/conf/mods-available/log_config.conf
+++ b/httpd2/conf/mods-available/log_config.conf
@@ -8,12 +8,12 @@
        # The following directives define some format nicknames for use with
        # a CustomLog directive (see below).
        #
-       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
-       LogFormat "%h %l %u %t \"%r\" %>s %b" common
+       LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+       LogFormat "%a %l %u %t \"%r\" %>s %b" common
 
        <IfModule logio_module>
                # You need to enable mod_logio.c to use %I and %O
-               LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
+               LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
        </IfModule>
 
Предлагаю 
а) сделать эту замену в пакете
б) приложить конфиг для remoteip
Comment 1 Anton Farygin 2018-10-05 08:27:26 MSK
Давай pull request
Comment 2 Repository Robot 2018-10-25 05:26:14 MSK
apache2-1:2.4.37-alt1 -> sisyphus:

Wed Oct 24 2018 Anton Farygin <rider@altlinux.ru> 1:2.4.37-alt1
- 2.4.37
- removed TimeoutStartSec in httpd.service (closes: #27925)
- save to log remoteip instead of remote hostname for fix of work with
  mod_remoteip module (closes: #34974)