2017-01-16 64 views
2

在虛擬服務器上,我需要在其他網站旁邊運行eXist-db應用程序。在我的應用程序中使用cookie來登錄和註銷。如何在Apache中正確配置VirtualHost(用於eXist-db應用程序)

這些設置爲Firefox工作得很好,一切都按預期運行:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerName my-app.my-domain.com 
    ProxyRequests off 
    ProxyPass/http://xx.xx.xx.xx:xxxx/exist/apps/my-app/ 
    ProxyPassReverse/http://xx.xx.xx.xx:xxxx/exist/apps/my-app/ 
    ProxyPassReverseCookiePath/http://my-app.my-domain.com 
</VirtualHost> 

我知道這些設置可能顯得有些奇怪,但他們是我能找到的最好的,就像我上面說他們只是爲了工作良好Firefox瀏覽器。它們可能特定於使用eXist-db應用程序。 (我的靈感來自this solution。)

但是,在IE 11中存在一些問題。我可以登錄每一頁,只要我嘗試訪問其他安全頁面(或相同!),我已註銷。我知道ProxyPassReverseCookieDomain的可能性,但不知道如何使用它。我試過localhost my-domain.com和類似的,但沒有任何工作。

在應用程序的控制器中,我將禁用所有緩存(no-cache, no-store, must-revalidate),這是跨頁面正確登錄和退出所必需的。

apache2 -S日誌:

[Mon Jan 16 16:09:10.287083 2017] [core:warn] [pid 16104] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined 
[Mon Jan 16 16:09:10.287698 2017] [core:warn] [pid 16104] AH00111: Config variable ${APACHE_PID_FILE} is not defined 
[Mon Jan 16 16:09:10.288003 2017] [core:warn] [pid 16104] AH00111: Config variable ${APACHE_RUN_USER} is not defined 
[Mon Jan 16 16:09:10.288220 2017] [core:warn] [pid 16104] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined 
[Mon Jan 16 16:09:10.288490 2017] [core:warn] [pid 16104] AH00111: Config variable ${APACHE_LOG_DIR} is not defined 
[Mon Jan 16 16:09:10.293480 2017] [core:warn] [pid 16104:tid 140486280820608] AH00111: Config variable ${APACHE_LOG_DIR} is not defined 
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf: 
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR} 
+1

有趣的是,你正在失去一個後端的會話,人們會期望看到你在平衡器中描述的這種行爲。儘管如此,還是有趣的。 –

+0

目前,這個主機是兩個之一。另一個是用Harp.js提供的非常簡單的靜態網頁。 –

回答

1

的解決方案是:ProxyPassReverseCookiePath /exist /

我想通了,從檢查的Cookie參數經由Firebug所示。 URL的/exist部分沒有被懷疑,因爲它被控制器重寫並且在地址欄中沒有看到。

JSESSIONID有路徑值/,登錄cookie /exist。現在他們有/

1

嘗試集代理配置成位置

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    ServerName my-app.my-domain.com 
    ProxyRequests off 
    <Location /> 
     ProxyPass http://xx.xx.xx.xx:xxxx/exist/apps/my-app/ 
     ProxyPassReverse http://xx.xx.xx.xx:xxxx/exist/apps/my-app/ 
     ProxyPassReverseCookiePath http://my-app.my-domain.com 
    </Location> 
</VirtualHost> 
+0

謝謝!但是,仍然適用於Firefox,不適用於IE。 cookies的最後一個參數必須有兩個或三個參數。我用我原來的配置相同。 –

相關問題