Назад | Перейти на главную страницу

Перенаправляются хосты Apache 2.4 (неправильная маршрутизация)

У меня проблема с конфигурацией apache, например эта проблема (Apache 2.2.22 - случайная неверная маршрутизация Vhost)

У меня есть несколько доменов, обслуживаемых одним и тем же apache (с использованием vhosts). иногда я получал ответ из другого домена, кроме того, который я запрашиваю.

Пример:

Listen 80
Listen 443

Define HOST_NAME        domain1.com
Define REV_HOST_NAME    com.domain1
#-- HTTP
<VirtualHost *:80>

        ServerName      www.${HOST_NAME}
        ServerAlias     ${HOST_NAME}            *.${HOST_NAME}

        # Redirect any HTTP request to HTTPS
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

        # Logging
        LogLevel warn
        ErrorLog /var/log/httpd/${REV_HOST_NAME}-error.log
        CustomLog /var/log/httpd/${REV_HOST_NAME}-access.log combined

</VirtualHost>

#-- HTTPS
<VirtualHost *:443>

        ServerName      www.${HOST_NAME}
        ServerAlias     ${HOST_NAME}            *.${HOST_NAME}

        #-- Logging
        LogLevel debug
        ErrorLog /var/log/httpd/${REV_HOST_NAME}-error.log
        CustomLog /var/log/httpd/${REV_HOST_NAME}-access.log combined

        ProxyPreserveHost       On
        ProxyRequests           Off
        SSLProxyEngine          On

        SSLEngine               On

        ## some other config here ...


        Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
        <Proxy "balancer://balancer_domain1">
            BalancerMember http://192.168.2.110:81/         retry=10        route=d1node1
            ProxySet stickysession=ROUTEID
            Require all granted
        </Proxy>

        ProxyPass               /       balancer://balancer_domain1/
        ProxyPassReverse        /       balancer://balancer_domain1/

</VirtualHost>


Define HOST_NAME        domain2.com
Define REV_HOST_NAME    com.domain2
#-- HTTP
<VirtualHost *:80>

        ServerName      www.${HOST_NAME}
        ServerAlias     ${HOST_NAME}            *.${HOST_NAME}

        # Redirect any HTTP request to HTTPS
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

        # Logging
        LogLevel warn
        ErrorLog /var/log/httpd/${REV_HOST_NAME}-error.log
        CustomLog /var/log/httpd/${REV_HOST_NAME}-access.log combined

</VirtualHost>

#-- HTTPS
<VirtualHost *:443>

        ServerName      www.${HOST_NAME}
        ServerAlias     ${HOST_NAME}            *.${HOST_NAME}

        #-- Logging
        LogLevel debug
        ErrorLog /var/log/httpd/${REV_HOST_NAME}-error.log
        CustomLog /var/log/httpd/${REV_HOST_NAME}-access.log combined

        ProxyPreserveHost       On
        ProxyRequests           Off
        SSLProxyEngine          On

        SSLEngine               On

        ## some other config here ...


        Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
        <Proxy "balancer://balancer_domain2">
            BalancerMember http://192.168.2.110:82/         retry=10        route=d2node1
            ProxySet stickysession=ROUTEID
            Require all granted
        </Proxy>

        ProxyPass               /       balancer://balancer_domain2/
        ProxyPassReverse        /       balancer://balancer_domain2/

</VirtualHost>

При проверке журнала /var/log/httpd/com.domain2-error.log я обнаружил такую ​​строку:

[Thu Sep 12 03:03:52.046630 2019] [ssl:debug] [pid 9009] ssl_engine_kernel.c(1891): [client 102.78.23.167:34001] AH02043: SSL virtual host for servername domain1.com found

Есть идеи, как исправить эту проблему