我在我的服務器上使用棘輪websocket。它運行良好,沒有SSL,但我需要使它與SSL一起工作。棘輪websocket SSL
我讀過這stackoverflow post。不幸的是,我的PAAS的支持不使用httpd.conf。他們建議我直接在.htaccess中添加ProxyPass。
關於增加在httpd.conf文件以下行,然後在這裏我 想爲 服務器是基於Debian和我們使用的Apache Web服務器,以告知我們沒有使用的httpd服務器上。我相信 你可以在htaccess文件中使用相同的行,或者如果你可以向開發人員諮詢 ,這會更好。
# ProxyPass for Ratchet with SSL
ProxyPass /wss2/ ws://127.198.132.141:8000/
# Preventing the app from being indexed
Header set X-Robots-Tag "noindex, nofollow"
# Use the front controller as index file. It serves as a fallback solution when
# every other rewrite/redirect fails (e.g. in an aliased environment without
# mod_rewrite). Additionally, this reduces the matching process for the
# start page (path "/") because otherwise Apache will apply the rewriting rules
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
DirectoryIndex app.php
# By default, Apache does not evaluate symbolic links if you did not enable this
# feature in your server configuration. Uncomment the following line if you
# install assets as symlinks or if you experience problems related to symlinks
# when compiling LESS/Sass/CoffeScript assets.
# Options FollowSymlinks
# Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve
# to the front controller "/app.php" but be rewritten to "/app.php/app".
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
[...]
不幸的是添加的ProxyPass/WSS2/WS://127.198.132.141:8000 /崩潰的服務器彷彿的.htaccess是不正確的。
你有任何解決方案或提示?
UPDATE:
從我的理解,我們不能在.htaccess中使用的ProxyPass應該在服務器配置或虛擬主機配置的前提下使用。
我試圖向支持人員解釋,但他們似乎並不理解。
很明顯,在.htaccess中禁止使用ProxyPass。
「ProxyPass和ProxyPassReverse僅在服務器 配置和虛擬主機上下文中可用。」
因此,如果您不能在服務器配置中添加此行,是否可以在虛擬主機上下文中添加 ?
他們的回答是:
當我再次回顧了服務器的水平,這 包括Apache模塊和防火牆規則,使棘輪 的WebSockets能夠在服務器上還運行所有的設置我們在防火牆中添加了 的規則表示在端口8000上允許來自外部的所有通信量爲 ,我相信這應該足以讓 允許websocket的外部連接。
截至目前,似乎你正在嘗試使用 連接不同的端口(在https的情況下)。正如我們已經審查了服務器 的設置和配置,似乎都很好。
如果您可以讓 這個過程中的開發人員參與其中,那麼他可以更好地引導您,因爲他知道代碼級別 好得多。
眼下試圖使用WSS連接會拋出:
WebSocket連接到 'WSS://127.198.132.141/wss2/' 失敗: 的WebSocket打開握手被取消
與ws一起使用http運行良好。
你解決了嗎?我有同樣的問題 – Andreah
嗨,不幸的是,因爲我不能在我的主機上配置太多。我現在不得不停止使用SSL。我仍然有興趣找到解決方案;)。 – Brieuc
我使用端口8888修復。我嘗試過使用8080而沒有成功。我也寫了一個aswer,希望它有幫助。 – Andreah