2016-09-15 13 views
1

私はApache Webserverの背後にあるApache Zeppelinインスタンスを実行しています。このWebサーバーは予約プロキシとしてのみ機能します。Apacheリバースプロキシの背後にあるApache Zeppelin

リバースプロキシサイトを参照している場合https://my-domain.com/zeppelin/私はアセットとボタンなどのすべてのWebサイトを取得していますが、Zeppelinのwebsocketは接続しません。 Browser-Dev-Toolsはhttps://my-domain.com/zeppelin/ws405 HTTP method GET is not supported by this URLと言っています。

私がツェッペリンウェブサイト(fe. http://priv.my-domain.com/zeppelin)で直接行っても、すべて正常に動作します。だから、Zeppelin-Codeのバグではないようですが、reverse-proxy-configの問題です。私は設定から​​最初のWS-場所を削除する場合には違いはありません

<VirtualHost *:443> 
    ServerName my-domain.com 
    # don't loose time with IP address lookups 
    HostnameLookups Off 
    ProxyRequests Off 
    ProxyPreserveHost Off 
    SSLEngine On 
    SSLProxyEngine On 
    SSLProxyVerify none 
    SSLProxyCheckPeerCN off 
    SSLProxyCheckPeerName off 
    ... 
    ssl cert stuff 
    ... 
    <Location /zeppelin/ws> 

     ProxyPass ws://priv.my-domain.com:8080/zeppelin/ws 
     ProxyPassReverse ws://priv.my-domain.com:8080/zeppelin/ws 

     Order deny,allow 
     Deny from all 

     Allow from <my-ip> 

    </Location> 

    <Location /zeppelin/> 

     ProxyPass http://priv.my-domain.com:8080/zeppelin/ 
     ProxyPassReverse http://priv.my-domain.com:8080/zeppelin/ 

     Order deny,allow 
     Deny from all 

     Allow from <my-ip> 

    </Location> 
    <Proxy *> 
     AddDefaultCharset Off 
     Order deny,allow 
     Allow from all 
    </Proxy> 
</VirtualHost> 

:よう

私のApacheのリバースプロキシの設定に見えます。 ご存知ですか?

解決策:以下の回答の後、私はconfファイルを修正しました。本当にありがとう!

私の作業CONF:これはあなたのニーズに必ずしも適用できない一部の指定がある私が使用していますconfにある

<VirtualHost *:443> 
    ServerName my-domain.com 
    # don't loose time with IP address lookups 
    HostnameLookups Off 
    ProxyRequests Off 
    ProxyPreserveHost Off 
    SSLEngine On 
    SSLProxyEngine On 
    SSLProxyVerify none 
    SSLProxyCheckPeerCN off 
    SSLProxyCheckPeerName off 
    ... 
    ssl cert stuff 
    ... 
    <Location /zeppelin/> 

     ProxyPass http://priv.my-domain.com:8080/zeppelin/ 
     ProxyPassReverse http://priv.my-domain.com:8080/zeppelin/ 

     Order deny,allow 
     Deny from all 

     Allow from <my-ip> 

    </Location> 
    RewriteEngine On 
    RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV] 
    RewriteRule ^/(.*) ws://priv.my-domain.com:8080/$1 [P] 
    <Proxy *> 
     AddDefaultCharset Off 
     Order deny,allow 
     Allow from all 
    </Proxy> 
</VirtualHost> 

答えて

2


- 1インスタンスあたり - mesosクラスタ
の前でサービス検出がユーザーと資格情報に基づいてルーティングをユーザーが
ここ

<VirtualHost *:3128> 
    <Location "/"> 
     AuthUserFile /.............../users 
     AuthName "xxxxxxxxxxxxx" 
     AuthGroupFile /dev/null 
     AuthType Basic 
     Require valid-user 
    </Location> 
    ServerName xxxxxxxxxxxxxxxxxxxxxxxxxxx 
    # SSLEngine on 
    # SSLCertificateFile "/.............../xxxxx.crt" 
    # SSLCertificateKeyFile "/.............../xxxxx.key" 

    #RewriteRules for datalab with user 
    RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV] 
    RewriteCond %{LA-U:REMOTE_USER} (aaaa) 
    RewriteRule ^/(.*) ws://azerty01:31321/$1 [P] 
    RewriteCond %{LA-U:REMOTE_USER} (aaaa) 
    RewriteRule ^/(.*) http://azerty01:31321/$1 [P,QSA,L] 
    ProxyPassReverse/http://azerty01:31321 

    #RewriteRules for datalab with user 
    RewriteCond %{HTTP:Upgrade} =WebSocket [NC,NV] 
    RewriteCond %{LA-U:REMOTE_USER} (bbbb) 
    RewriteRule ^/(.*) ws://azerty02:31901/$1 [P] 
    RewriteCond %{LA-U:REMOTE_USER} (bbbb) 
    RewriteRule ^/(.*) http://azerty02:31901/$1 [P,QSA,L] 
    ProxyPassReverse/http://azerty02:31901 

</VirtualHost> 
+0

ありがとうございました。ユーザー認証なしの簡略化されたRewrite-Partについては、私のEDITを参照してください。 – BeerCamper

1

である私は、プロキシ0を反転したいときに私が作成したファイルを含みますツェッペリンサーバー。好みの場合は、vhosts confファイルに切り取って貼り付けることができます。

# 
# Apache Reverse Proxy settings for Zeppelin server. 
# note: 
# Change ZEPPELING_IP_OR_HOST and ZEPPELIN_PORT as appropriate. 
# 
# FreeBSD put into /usr/local/etc/apache24/Includes directory, 
# Linux may vary. 

# This is for your-host.your-domain.com/zeppelin 
# if you want zeppelin.your-host.your-domain.com 
# Put this into a vhosts file. 

RequestHeader set X_FORWARDED_PROTO 'https' 
ProxyPreserveHost On 
RequestHeader set X-Forwarded-Port "443" 
ProxyRequests  Off 
ProxyVia Off 
AllowEncodedSlashes NoDecode 


<Location /zeppelin/ws> 
    ProxyPass ws://ZEPPELIN_IP_OR_HOST:ZEPPELIN_PORT/zeppelin/ws 
    ProxyPassReverse ws://ZEPPELIN_IP_OR_HOST:ZEPPELIN_PORT/zeppenlin/ws 
</Location> 

ProxyPass  /zeppelin  http://ZEPPELIN_IP_OR_HOST:ZEPPELIN_PORT/zeppelin 
ProxyPassReverse /zeppelin  http://ZEPPELIN_IP_OR_HOST:ZEPPELIN_PORT/zeppelin 
0

ちょうどこれに追加すると、以下の設定でApache2を使用して、私のzeppelinインスタンスに再ルーティングできました。重要な部分はwebsocket接続です。

は、あなたが改造に

sudo a2enmod proxy_wstunnel 

を追加していることを確認します。私は、次のことを実行しました:

sudo a2dissite 000-default 
sudo nano /etc/apache2/sites-available/proxy-host.conf 
    # Insert the following into the proxy-host.conf file 
    <VirtualHost *:80> 
     ServerName '<Zeppelin Public IP>:8080' 
     RewriteEngine On 
     RewriteCond %{HTTP:Upgrade} =websocket [NC] 
     RewriteRule /(.*)   ws://<Zeppelin Public IP>:8080/$1 [P,L] 
     RewriteCond %{HTTP:Upgrade} !=websocket [NC] 
    RewriteRule /(.*)   http://<Zeppelin Public IP>:8080/$1 [P,L] 
    ProxyPassReverse/http://<Zeppelin Public IP>:8080/ 
    </VirtualHost> 
    #/text insert 
sudo a2ensite proxy-host 
sudo nano /etc/apache2/ports.conf 
    #Add this to the ports.conf file and cntrl+X to save & exit 
    Listen 8080 
sudo /etc/init.d/apache2 restart 

次にあなたがHTTPに行くとき:// reverseproxypublicIP /それはあなたのツェッペリンインスタンスにリルートます。これが誰かを助けることを願って!

関連する問題