【发布时间】:2015-09-11 21:09:48
【问题描述】:
我正在使用 Apache 构建一个代理,它基于 URL 代理所有内容。
我的网络服务器在本地运行:http://proxy
当我导航到 http://proxy/{insert-url-here} 我的服务器代理 http://proxy/{insert-url-here} 到 {insert-url-here} 时,html 已正确加载,但资源未加载。
这个问题的原因是从我的服务器发起的对所有资源的请求都是使用http://proxy作为主机定向的。我希望请求使用http://proxy/{insert-url-here} 作为主机 URL,以便请求可以找到所有资源。
我当前在 Apache 中的 VirtualHost 配置非常简单:
ServerAdmin webmaster@company.com
DocumentRoot "C:/proxy/htdocs"
ServerName http://proxy
ServerAlias http://proxy
ErrorLog "logs/error-ssl.log"
CustomLog "logs/access-ssl.log" common
ProxyRequests Off
ProxyPreserveHost On
RequestHeader unset Accept-Encoding
<Location />
Order allow,deny
Allow from all
</Location>
ProxyPassMatch /(.*) http://$1
ProxyPassReverse /(.*) http://$1
所需的解决方案:
我想将http://proxy/{insert-url-here} 正确代理到{insert-url-here}。如果我必须完全改变我当前的配置也没关系。
希望你们能帮帮我。
【问题讨论】:
标签: apache http url mod-rewrite proxy