(for simplicity I changed IPs of Apache server to 22.214.171.124 and Gollum server to 126.96.36.199)
I'm trying to serve a Gollum wiki with rack through Apache (since it has SSL set up properly and I'm currently only testing the Gollum wiki). So I setup Apache to ProxyPass (config below).
The problem is that the rack server seems to be working fine when I access it directly via a curl from my proxy machine:
188.8.131.52 - - [05/Dec/2013 06:20:25] "GET /docs/Home HTTP/1.1" 200 6467 0.2135
but I get a 404 whenever I try to use my browser. Rackup says:
184.108.40.206 - - [05/Dec/2013 06:20:00] "GET /docs/Home HTTP/1.1" 404 - 0.0006
Absurdly, when I use the exact same headers as my browser sends (see below) via telnet from the proxy machine (220.127.116.11) the request is successful:
18.104.22.168 - - [05/Dec/2013 06:19:19] "GET /docs/Home HTTP/1.1" 200 6467 0.2759
I have no idea what I'm doing wrong and why (and how?!) rack differentiates between two different requests from the same machine. Help please?
(Using Apache/2.2.15 on RHEL 5 and Rack 1.2 (Release: 1.5) on ruby 1.9.2p320, RHEL 6)
EDIT Apparently this is a problem with WEBrick, since when I switch to Thin it worked. Would still like your insights...
<VirtualHost 22.214.171.124:80> ServerName testserver.example.org ServerAlias testserver.example.org ServerAdmin email@example.com DocumentRoot /path/to/my/docs DirectoryIndex index.html index.htm index.php # ... <Location /docs/> ProxyPass http://126.96.36.199:8080/docs/ # also tried: # ProxyPass http://rackserver.example.org:8080/docs/ # and: # SetEnv force-proxy-request-1.0 1 # SetEnv proxy-nokeepalive 1 </Location> </VirtualHost>
<1>root@testserver:~$ telnet rackserver.example.org 8080 Trying 188.8.131.52... Connected to rackserver.example.org. Escape character is '^]'. GET /docs/Home HTTP/1.1 ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 ACCEPT_ENCODING: gzip,deflate,sdch ACCEPT_LANGUAGE: en-US,en;q=0.8,he;q=0.6 CACHE_CONTROL: max-age=0 COOKIE: SESS...; has_js=1 HOST: rackserver.example.org:8080 USER_AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36 VERSION: HTTP/1.1 X_FORWARDED_FOR: 184.108.40.206 X_FORWARDED_HOST: apacheserver.example.org X_FORWARDED_SERVER: testserver.example.org
I verified that the rack up prints the same output for the normal browser request and the telnetted request using the code from this answer.