0

I am trying to setup a proxy through Apache 2 on Ubuntu 14.04. I have two proxies that I want to use. One is for a Ruby Thin server running locally. The other is for a phone statistics page. I have configured a conf file with the following:

<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>

However, when I try to go to /phonestats/ I get a 404 error. The error log shows the following:

[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>

It seems that after the phonestats proxy goes through it attempts to proxy the information through the other proxy. I am not sure how to stop this or if I am even on the write path.

Is this better solved through a URL Rewrite?

t3h-chipmunk
  • 29
  • 1
  • 3

1 Answers1

2

The issue was that there was a query string in the URL that I was attempting to proxy to. Unfortunately, I removed that URL from the error log. The trick was to do the following:

ProxyPass http://phonestats:port/ nocanon
t3h-chipmunk
  • 29
  • 1
  • 3