使用apache的HTTPS反向代理

我正在使用这个Apacheconfiguration来设置一个反向代理,以运行在同一台机器上的进程,在端口8443,

<Directory "/var/www/html"> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*) https://%{HTTP_HOST}/$1 </Directory> <IfModule mod_proxy.c> ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> SSLProxyEngine On ProxyPass / https://127.0.0.1:8443/ ProxyPassReverse / https://127.0.0.1:8443/ </IfModule> 

在8443上运行的进程已经build立了HTTPS / SSL证书。 这是一个有效/良好的configuration,或者我可以做得更好吗?

我注意到,目前甚至http://将代理https://没有重写踢我想这可能会危及SSL? 我宁愿只有443代理8443,只是使用URL重写来重写http://请求https://请求。 这可能使用Apache?

谢谢。

编辑 – 这是请求的虚拟主机信息,

 VirtualHost Configuration: wildcard NameVirtualHosts and _default_ servers: _default_:443 127.0.0.1 (/etc/httpd/conf.d/ssl.conf:74) Syntax OK 

为了让HTTP请求redirect而不是代理,你应该做两件事情:

  1. 将您的代理configuration( SSLProxyEngine通过ProxyPassReverse/etc/httpd/conf.d/ssl.conf的SSL虚拟主机中,以便它仅适用于此处

  2. 创build一个将redirect的HTTP虚拟主机 – 可能位于/etc/httpd/conf.d中的一个新的.conf文件中:

     <VirtualHost *:80> ServerName redirect RewriteEngine On RewriteRule ^(.*) https://%{HTTP_HOST}/$1 </VirtualHost>