请,我一直试图配置httpd没有运气。我需要以下行为:
- 如果我访问https://example.org/,https://example.org/anything/.../... -〉我需要本地主机的代理:8080(tomcat),example.org在http请求
ProxyPreserveHost On
中保留主机名“www.example.com“ - 如果我访问https://example.org/api/system-a/... -〉我需要到外部服务器的代理,而不在example.orghttp请求
ProxyPreserveHost Off
中保留主机名“www.example.com“
两个URL的SSL设置、主机名、端口等应相同...
我还没有能够在httpd中找到解决方案(在nginx中,你只是将指令proxy_set_header Host $host/$proxy_host
从http
或server
向下移动一级到配置的location
部分,但在httpd中,据我所知没有这样的事情).我还没有能够运行具有相同服务器名称和端口的2个vhost...
Listen 443 https
<VirtualHost *:443>
ServerName example.org
SSLEngine On
SSLProxyEngine On
ProxyErrorOverride On
ProxyPreserveHost On
ProxyRequests Off
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyPass /api/system-a/ https://external-domain.example2.org/system-a/
ProxyPassReverse /api/system-a/ https://external-domain.example2.org/system-a/
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
SSLEngine On
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 +TLSv1.2
SSLCipherSuite HIGH:!aNULL:!MD5
SSLHonorCipherOrder On
RequestHeader set X-Forwarded-Proto "https"
SSLCompression off
SSLSessionTickets Off
SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key
#websockets
RewriteEngine On
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule .* ws://localhost:8080%{REQUEST_URI} [P]
ProxyPass /websocket/ "ws://localhost:8080/websocket/"
ProxyPassReverse /websocket/ "ws://localhost:8080/websocket/"
</VirtualHost>
1条答案
按热度按时间sbtkgmzw1#
解决方案是关闭...节中的“ProxyPreserveHost”