对于使用Ant Media Server的扩展解决方案,如何在使用负载平衡器时将IP列入白名单?如您所知,负载均衡器的IP动态变化,Ant Media Server现在可以将域名列入白名单了吗?应该如何设置?
您对此请求有2个选择。
选项1-使用REST方法设置IP过滤器
步骤1-删除/AMS_DIR/webapps/root/WEB-INF/web.xml
]中的以下代码段
-使用支持GET方法的以下REST方法请求应用程序设置<filter> <filter-name>AuthenticationFilter</filter-name> <filter-class>io.antmedia.console.rest.AuthenticationFilter</filter-class> </filter> <filter-mapping> <filter-name>AuthenticationFilter</filter-name> <url-pattern>/rest/*</url-pattern> </filter-mapping>
[步骤2
http://domain-address.com:5080/rest/getSettings/WebRTCAppEE
返回该应用程序的设置对象。
[步骤3
-在设置对象中添加/编辑remoteAllowedCIDR
字段,然后将设置发送到对象至下面的以下REST方法。http://domain-address:5080/rest/changeSettings/WebRTCAppEE
请求类型:POST
Content-Type:application / json
您可以将逗号分隔的CIDR表示法或IP地址添加到remoteAllowedCIDR。例如:
remoteAllowedCIDR=127.0.0.1,12.44.55.3/24,192.123.33.66
注意:您可以更改请求https,端口地址,WebRTCAppEE之类的应用程序
选项2-使用MongoDB设置IP过滤器
步骤1
-更新settings.remoteAllowedCIDR
-> updateTime
-> MongoDB
中设置对象中的clusterdb
和AppSettings collection
字段。另外,您可以将MongoDB与服务连接。a-您可以像上面一样更改settings.remoteAllowedCIDR
b-您还应该更新updateTime
字段。您可以以毫秒为单位设置当前时间(System.currentTimeMillis())。让我提供更多有关为什么我们需要更新updateTime的信息。
每个AMS定期检查AppSettings中的updateTime
字段以更新应用程序设置。因此,在更新了remoteAllowedCIDR
字段之后,您需要更新updateTime
字段以使每个节点自行更新。
注意:在clusterdb中,应用程序设置作为一个集合存储在MongoDB中。
您还可以查看以下有关MongoDB事务和AppSettings类的文档:
https://docs.mongodb.com/manual/core/transactions-in-applications/