在 0.0.0.0 上收听时无法访问 Artemis GUI

Unable to access Artemis GUI when listening on 0.0.0.0

我正在以两种不同的方式初始化代理。一个监听 0.0.0.0,另一个监听节点 IP,即 172.29.245.17.

经纪人 1:

[root@amq-1 apache-artemis-2.4.0]# bin/artemis create --name BROKER-1 /var/tmp/BROKER-1  --user admin --password admin --http-host 0.0.0.0 --http-port 8080 --allow-anonymous

经纪人 2:

[root@amq-1 apache-artemis-2.4.0]# bin/artemis create --name BROKER-2 /var/tmp/BROKER-2  --user admin --password admin --http-host 172.29.245.17 --http-port 8080 --allow-anonymous

如您所见,唯一的区别是监听哪个IP。一个对所有人开放(0.0.0.0)。另一个只监听 1 个特定的 IP()。

访问 Broker-2 的 GUI 没有问题(一个在 172.29.245.17 上监听)

现在当我启动 Broker-1(监听 0.0.0.0)时,我被重定向到 /console/jvm/connect

错误状态 ::

[Core] Operation unknown failed due to: java.lang.Exception : Origin http://172.29.245.17:8080 is not allowed to call this agent
[Core] ActiveMQ Management Console started
[Window] Uncaught TypeError: Cannot read property 'apply' of undefined (http://172.29.245.17:8080/console/app/app.js?0d5300a336117972:16:14366)
[Window] Uncaught TypeError: Cannot read property 'apply' of undefined (http://172.29.245.17:8080/console/app/app.js?0d5300a336117972:16:14366)
[Window] Uncaught TypeError: Cannot read property 'apply' of undefined (http://172.29.245.17:8080/console/app/app.js?0d5300a336117972:16:14366)
[Window] Uncaught TypeError: Cannot read property 'apply' of undefined (http://172.29.245.17:8080/console/app/app.js?0d5300a336117972:16:14366)

对于 Broker-1 ,jolokia-access.xml 状态 ::

<restrict>

    <cors>
        <!-- Allow cross origin access from 0.0.0.0 ... -->
        <allow-origin>*://0.0.0.0*</allow-origin>

        <!-- Check for the proper origin on the server side, too -->
        <strict-checking/>
    </cors>

</restrict>

对于 Broker-2,jolokia-access.xml 状态:

<restrict>

    <cors>
        <!-- Allow cross origin access from 172.29.245.17 ... -->
        <allow-origin>*://172.29.245.17*</allow-origin>

        <!-- Check for the proper origin on the server side, too -->
        <strict-checking/>
    </cors>

</restrict>

我无法弄清楚为什么在我尝试收听 0.0.0.0 时会出现此问题。有任何想法吗 ?

所有其他配置都是默认的。我没有修改任何其他配置。

我认为这里的问题是您在 Broker-1 上的 jolokia-access.xml 使用的是:

<allow-origin>*://0.0.0.0*</allow-origin>

但是,在您的浏览器中,您尝试通过 172.29.245.17:8080 访问控制台,根据您的 jolokia-access.xml,这是不允许的。因此,您需要更改浏览器以连接到 0.0.0.0:8080(仅当 broker/console 在本地为 运行 时才有效)或更改 jolokia-access.xml 以允许 IP:port 你实际上要用来连接。

您可以在 Jolokia security documentation.

中阅读有关 jolokia-access.xml 的更多信息