RTMPT (RTMP over HTTP) を使用して、次の IP セキュリティ メカニズムを使用しています。
/open/1 リクエストを除いて、すべての RTMPT リクエストは、Apache 設定で mod_proxy を使用して red5 (ポート 5080) に渡されます。
#send open/1 request to authentification script:
Alias /open/1 /var/www/html/auth.php
#other RTMP request directly to red5:
ProxyPass /send http://localhost:5080/send
ProxyPassReverse /send http://localhost:5080/send
ProxyPass /idle http://localhost:5080/idle
ProxyPassReverse /idle http://localhost:5080/idle
ProxyPass /close http://localhost:5080/close
ProxyPassReverse /close http://localhost:5080/close
ProxyPass /fcs http://localhost:5080/fcs
ProxyPassReverse /fcs http://localhost:5080/fcs
ユーザーがプレーヤーを起動すると、Web ページは最初に php スクリプトにアクセスして、ユーザーがログインしていることを確認します。ログインしている場合、現在の時刻 (タイムスタンプ) を含む IP アドレスが一時的に保存されます。次に、RTMPT ストリームがポート 80 で開始されます。これで、auth.php スクリプトがプレーヤーから /open/1 リクエストを受け取ります。IP アドレスとタイムスタンプをチェックします。IP アドレスが存在し、タイムスタンプが約 3 秒経過していない場合、/open/1 要求が red5 に渡されます。結果 (識別子) がプレーヤーに返されます。PHP の場合:
<?php
//after user is verified, send /open/1 request to red5:
$data = `curl -s -F a=b localhost:5080/open/1`;
$data_size = strlen($data);
header("Content-Type: application/x-fcs");
header("Connection: Keep-Alive");
header("Content-Length: $data_size");
header('Cache-Control: no-cache');
echo $data; //return answer from red5 (identifier) back to player
exit;
?>
残念ながら、/open/1 リクエストには Web ページからの Cookie やリファラー情報は含まれていません。クライアントからの REMOTE_ADDR (IP アドレス) と REQUEST_TIME のみが PHP $_SERVER 変数 (JW-player を使用) からの有用な情報です。