Apache 多重代理通行证 404

Apache 多重代理通行证 404

我正在尝试通过 Ubuntu 14.04 上的 Apache 2 设置代理。我有两个要使用的代理。一个用于本地运行的 Ruby Thin 服务器。另一个用于手机统计页面。我已配置了以下内容的 conf 文件:

<VirtualHost *:80>
    Redirect permanent / <ssl_site>
</VirtualHost>

<VirtualHost _default_:443>
    --snip certificate info--
    --snip contact info--

    LogLevel debug
    --snip log info--

    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
        Order Allow,Deny
        Allow from all
    </Proxy>

    SSLProxyEngine On

    <Location />
        ProxyPass <Ruby thin server>
        ProxyPassReverse <Ruby thin server>
    </Location>

    <Location /phonestats/>
        RequestHeader set Authorization "Basic <Base64 username:password>"
        ProxyPreserveHost On

        ProxyPass http://phonestats:port/
        ProxyPassReverse http://phonestats:port/
    </Location>
</VirtualHost>

但是,当我尝试访问 /phonestats/ 时,出现 404 错误。错误日志显示以下内容:

[Tue Apr 21 10:27:21.042723 2015] [proxy:debug] [pid 3138:tid 139930961352576] proxy_util.c(1694): AH00925: initializing worker <phonestats url> shared
[Tue Apr 21 10:27:21.042727 2015] [proxy:debug] [pid 3138:tid 139930961352576] proxy_util.c(1734): AH00927: initializing worker <phonestats url> local
[Tue Apr 21 10:27:21.042736 2015] [proxy:debug] [pid 3138:tid 139930961352576] proxy_util.c(1769): AH00930: initialized pool in child 3138 for (phonestats) min=0 max=25 smax=25
[Tue Apr 21 10:27:21.043273 2015] [proxy:debug] [pid 3137:tid 139930961352576] proxy_util.c(1694): AH00925: initializing worker <phonestats url> shared
[Tue Apr 21 10:27:21.043277 2015] [proxy:debug] [pid 3137:tid 139930961352576] proxy_util.c(1734): AH00927: initializing worker <phonestats url> local
[Tue Apr 21 10:27:21.043286 2015] [proxy:debug] [pid 3137:tid 139930961352576] proxy_util.c(1769): AH00930: initialized pool in child 3137 for (phonestats) min=0 max=25 smax=25
[Tue Apr 21 10:27:24.902951 2015] [proxy:debug] [pid 3137:tid 139930755913472] proxy_util.c(2072): [client 192.168.3.141:52496] AH00944: connecting <phonestats url> to <phonestats host>
[Tue Apr 21 10:27:29.908518 2015] [proxy:debug] [pid 3137:tid 139930755913472] proxy_util.c(2206): [client 192.168.3.141:52496] AH00947: connected <phonestats path> to <phonestats host>
[Tue Apr 21 10:27:29.909235 2015] [proxy:debug] [pid 3137:tid 139930755913472] proxy_util.c(2610): AH00962: HTTP: connection complete to 192.168.3.21:8081 (phonestats)
[Tue Apr 21 10:27:30.120569 2015] [ssl:debug] [pid 3137:tid 139930730735360] ssl_engine_kernel.c(222): [client 192.168.3.141:52496] AH02034: Subsequent (No.5) HTTPS request received for child 0 (server <server url>), referer: <HTTP referer>
[Tue Apr 21 10:27:30.120614 2015] [authz_core:debug] [pid 3137:tid 139930730735360] mod_authz_core.c(828): [client 192.168.3.141:52496] AH01628: authorization result: granted (no directives), referer: <HTTP referer>
[Tue Apr 21 10:27:30.120646 2015] [proxy:debug] [pid 3137:tid 139930730735360] mod_proxy.c(1104): [client 192.168.3.141:52496] AH01143: Running scheme http handler (attempt 0), referer: <HTTP referer>
[Tue Apr 21 10:27:30.120662 2015] [proxy:debug] [pid 3137:tid 139930730735360] proxy_util.c(2072): [client 192.168.3.141:52496] AH00944: connecting http://<Thin Server>/favicon.ico to <Thin Server>, referer: <HTTP referer>
[Tue Apr 21 10:27:30.120668 2015] [proxy:debug] [pid 3137:tid 139930730735360] proxy_util.c(2206): [client 192.168.3.141:52496] AH00947: connected /favicon.ico to <Thin Server>, referer: <HTTP referer>

似乎在 phonestats 代理通过后,它会尝试通过其他代理代理代理信息。我不确定如何停止这种情况,或者我是否处于写入路径上。

通过 URL 重写能更好地解决这个问题吗?

答案1

问题是我尝试代理的 URL 中有一个查询字符串。不幸的是,我从错误日志中删除了该 URL。诀窍是执行以下操作:

ProxyPass http://phonestats:port/ nocanon

相关内容