我有一个公共Apache服务器,它需要代理到内部Apache服务器(用于SVN访问)。我想要的是:
User ---[HTTPS]---> Web Server ---[HTTP]---> SVN Server我对SSL处理不是很熟悉,所以我想要一些关于这种方法的意见。这是一个ok模型吗?我应该在任何地方都使用SSL吗,等等。
我的方法在很大程度上是有效的,但在重写重定向回HTTPS时失败了。如果用户转到
https://acme.web.mcx/svn (no trailing '/')它们由SVN服务器重定向到
http://acme.web.mcx/svn/ (almost there!) 以下是我对Web服务器(代理服务器)的配置:
<VirtualHost *:443>
ServerAdmin me@admin.com
ServerAlias *.web.mcx www.web.mcx web.mcx
DocumentRoot /server/web/app/webroot
ErrorLog logs/web-error_log
CustomLog logs/web-access_log common
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.web\.mcx$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.web\.mcx$ [NC]
RewriteRule ^/svn(.*) http://db.mcx/svn$1 [P]
ProxyPassReverse /svn http://db.mcx/svn
ProxyPreserveHost on
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/server.crt
SSLCertificateKeyFile /etc/httpd/ssl/server.key
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyVia On
<Location /svn/>
<Limit OPTIONS PROPFIND GET REPORT MKACTIVITY PROPPATCH PUT CHECKOUT MKCOL MOVE COPY DELETE LOCK UNLOCK MERGE>
Order Deny,Allow
Allow from all
Satisfy Any
</Limit>
</Location>
发布于 2010-12-19 14:45:40
我一直在回答我自己的问题:)
这是我的“工作到崩溃”的解决方案:我改变了我的VirtualHost设置,总是将/svn*的请求重定向到https。客户端有时会被重定向两次(如果他们不使用尾部斜杠的话),但这对我来说没问题。重定向一: SVN服务器使用斜杠将客户端重定向到正确的路径(尽管忘记了https),重定向二: Web服务器将客户端重定向回https。
<VirtualHost *:80>
ServerAdmin me@admin.com
ServerAlias *.web.mcx www.web.mcx web.mcx
DocumentRoot /server/web/app/webroot
ErrorLog logs/web-error_log
CustomLog logs/web-access_log common
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.web\.mcx$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.web\.mcx$ [NC]
RewriteCond %{REQUEST_URI} svn.*
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R,L]
ProxyRequests Off
</VirtualHost>https://stackoverflow.com/questions/4481892
复制相似问题