(为了简单起见,我将Apache服务器的IP改为1.1.1.1,将Gollum服务器改为6.6.6.6)
我试图通过Apache服务于Gollum wiki,因为它已经正确设置了SSL,而且我目前只在testingGollum wiki。 所以我把Apache设置为ProxyPass(config下面)。
问题是机架服务器似乎工作正常,当我直接从我的代理机器通过curl访问它:
1.1.1.1 - - [05/Dec/2013 06:20:25] "GET /docs/Home HTTP/1.1" 200 6467 0.2135
但是每当我尝试使用我的浏览器时,我都会得到一个404。 Rackup说:
6.6.6.6 - - [05/Dec/2013 06:20:00] "GET /docs/Home HTTP/1.1" 404 - 0.0006
荒谬的是,当我使用与我的浏览器通过代理服务器(1.1.1.1)的telnet发送(如下所示)完全相同的标题时,请求成功:
6.6.6.6 - - [05/Dec/2013 06:19:19] "GET /docs/Home HTTP/1.1" 200 6467 0.2759
我不知道我在做什么错,为什么(以及如何?!)机架区分来自同一台机器的两个不同的请求。 请帮助?
(在ruby 1.9.2p320,RHEL 6上,在RHEL 5和Rack 1.2(Release:1.5)上使用Apache / 2.2.15)
编辑显然,这是WEBrick的问题,因为当我切换到薄它的工作。 还是会喜欢你的见解…
Apacheconfiguration:
<VirtualHost 1.1.1.1:80> ServerName testserver.example.org ServerAlias testserver.example.org ServerAdmin [email protected] DocumentRoot /path/to/my/docs DirectoryIndex index.html index.htm index.php # ... <Location /docs/> ProxyPass http://6.6.6.6: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>
Telnet请求:
<1>root@testserver:~$ telnet rackserver.example.org 8080 Trying 6.6.6.6... 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: 6.6.6.6 X_FORWARDED_HOST: apacheserver.example.org X_FORWARDED_SERVER: testserver.example.org
我validation了机架打印输出正常的浏览器请求和远程请求使用此答案的代码相同的输出。