Apache ProxyPass to Rack 出現 404 錯誤

Apache ProxyPass to Rack 出現 404 錯誤

(為了簡單起見,我將 Apache 伺服器的 IP 變更為 1.1.1.1,將 Gollum 伺服器的 IP 變更為 6.6.6.6)

我正在努力服務咕嚕透過 Apache 進行帶有機架的 wiki(因為它正確設定了 SSL 並且我目前只測試 Gollum wiki)。所以我將 Apache 設定為 ProxyPass(配置如下)。

問題是,當我從代理機器通過curl直接訪問機架伺服器時,它似乎工作正常:

1.1.1.1 - - [05/Dec/2013 06:20:25] "GET /docs/Home HTTP/1.1" 200 6467 0.2135

但每當我嘗試使用瀏覽器時,我都會收到 404 錯誤。機架 說:

6.6.6.6 - - [05/Dec/2013 06:20:00] "GET /docs/Home HTTP/1.1" 404 - 0.0006

荒謬的是,當我使用精確的與我的瀏覽器透過 telnet 從代理電腦 (1.1.1.1) 發送的標頭相同(見下文),請求成功:

6.6.6.6 - - [05/Dec/2013 06:19:19] "GET /docs/Home HTTP/1.1" 200 6467 0.2759

我不知道我做錯了什麼,也不知道為什麼(以及如何?!)機架區分來自同一台機器的兩個不同請求。請幫忙?

(在 RHEL 5 上使用 Apache/2.2.15,在 ruby​​ 1.9.2p320、RHEL 6 上使用 Rack 1.2(版本:1.5))

編輯顯然這是 WEBrick 的問題,因為當我切換到 Thin 時它就起作用了。還是希望您的見解...


阿帕契配置:

<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

我驗證了機架為正常瀏覽器請求和 telnet 請求列印了相同的輸出,使用這個答案中的程式碼

相關內容