自宅Webサーバー環境でMastodonを立てるにあたり、すでにUbuntu 18.04+ApacheのサーバーからMastodonサーバー(別のサーバーでDocker運用)にリバースプロキシーするようにしていたのですが、なんかストリーミングが動いていない。ログを漁ったらApacheがエラーを出していました。
AH01144: No protocol handler was valid for the URL /api/v1/streaming/public/local (scheme 'ws'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
proxy系のモジュールは有効になっているはずですが。
# a2query -m | grep proxy proxy_wstunnel (enabled by site administrator) proxy_http (enabled by site administrator) proxy (enabled by site administrator)
設定もサンプル通りなので、はて。それに
ProxyPass "/api/v1/streaming/" "ws://192.168.29.14:4000/" ProxyPassReverse "/api/v1/streaming/" "ws://192.168.29.14:4000/"
ぐぐると、どうもUbuntuのアップストリームであるところのDebianでバグ報告が1年半ほど放置されているのを見つけました。まあ多分これでしょう。腐ってやがる。
いくつかWorkaroundは書かれていますが、mod_rewriteの方法は私がクソなせいで設定がループしてしまう状態。ちなみにバグレポートの「RewriteCond %{HTTP:Connection
# これは動かない RewriteEngine On RewriteCond %{HTTP:Upgrade} =websocket [NC] RewriteRule /api/v1/streaming/(.*) ws://192.168.29.14:4000/$1 [P,L] ProxyPass /api/v1/streaming/ http://192.168.29.14:4000/ ProxyPassReverse /api/v1/streaming/ http://192.168.29.14:4000/
いまのところ、CentOS 7を選んでいればよかったのか……というお気持ちです。誰か助けてー。
# cat /etc/issue Ubuntu 18.04.2 LTS \n \l # apache2ctl -v Server version: Apache/2.4.29 (Ubuntu)