Proxy 如何设置连接MQTT网桥的代理?

Proxy 如何设置连接MQTT网桥的代理?,proxy,mqtt,mosquitto,Proxy,Mqtt,Mosquitto,我有一个在linux上运行的mosquitto代理,在我公司代理的后面。 我已经配置了一个到AWS的桥接器,如下所示:(mosquitto.conf) 但当我使用命令启动mosquitto服务时: service mosquitto restart 在日志文件中,存在一些错误: 1554356888: mosquitto version 1.5.5 starting 1554356888: Config loaded from /etc/mosquitto/mosquitto.conf. 15

我有一个在linux上运行的mosquitto代理,在我公司代理的后面。 我已经配置了一个到AWS的桥接器,如下所示:(mosquitto.conf)

但当我使用命令启动mosquitto服务时:

service mosquitto restart
在日志文件中,存在一些错误:

1554356888: mosquitto version 1.5.5 starting
1554356888: Config loaded from /etc/mosquitto/mosquitto.conf.
1554356888: Opening ipv4 listen socket on port 1883.
1554356888: Opening ipv6 listen socket on port 1883.
1554356888: Warning: Address family not supported by protocol
1554356888: Connecting bridge bridge (ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089)
1554356888: Error creating bridge: Name or service not known.
1554356888: Warning: Unable to connect to bridge bridge.
1554356901: New connection from 127.0.0.1 on port 1883.
1554356901: New connection from 127.0.0.1 on port 1883.
1554356901: New client connected from 127.0.0.1 as mqtt_fd05fada.b70918 (c1, k60).
1554356901: New client connected from 127.0.0.1 as mqtt_2a3a025d.6c941e (c1, k60).
1554356919: Connecting bridge bridge (ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089)
1554356919: Error creating bridge: Name or service not known.
1554356950: Connecting bridge bridge (ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com:8089)
1554356950: Error creating bridge: Name or service not known.
我认为原因是我的公司代理人。 我尝试了mosquitt.service中的设置,但无法解决

[Unit]
Description=Mosquitto MQTT v3.1/v3.1.1 Broker
Documentation=man:mosquitto.conf(5) man:mosquitto(8)
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
NotifyAccess=main
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Environment="HTTPS_PROXY=http://user:pass@proxyhost:8800"
Environment="HTTP_PROXY=http://user:pass@proxyhost:8800"
Environment="NO_PROXY=127.0.0.1,localhost"
Restart=on-failure

[Install]
WantedBy=multi-user.target

有人能帮我吗?非常感谢。

您不能将HTTP代理用于MQTT网桥连接(或任何本机MQTT连接)。MQTT是一种完全不同的协议


只有WebSocket上的MQTT可以通过HTTP代理工作,但您不能将MOSQUITO配置为使用WebSocket上的MQTT运行网桥。

您不能将HTTP代理用于MQTT网桥连接(或任何本机MQTT连接)。MQTT是一种完全不同的协议


只有Websockets上的MQTT可以通过HTTP代理工作,但您不能将MOSQUITO配置为使用Websockets上的MQTT运行网桥。

如果在发送CONNECT之前使用HTTP CONNECT 在net_mosq.c中

rc = connect(*sock, rp->ai_addr, rp->ai_addrlen);
我们可以做到这一点


HTTP CONNECT与协议无关,它在底层TCP协议上工作。

如果在发送CONNECT之前使用HTTP CONNECT 在net_mosq.c中

rc = connect(*sock, rp->ai_addr, rp->ai_addrlen);
我们可以做到这一点


HTTP CONNECT与协议无关,它适用于底层TCP协议。

感谢您的支持。我已经按照说明进行了操作:但Lan网络中的MQTT代理运行在我公司代理的后面。那么,我可以用这种架构部署吗?不,在这种情况下不需要nginx。你能告诉我如何实现吗?对不起,请慢慢来。非常感谢。如果您的局域网只允许通过HTTP代理进行出站连接,那么您不能这样做,我不能在代理后面创建MQTT网桥。是吗?谢谢你的支持。我已经按照说明进行了操作:但Lan网络中的MQTT代理运行在我公司代理的后面。那么,我可以用这种架构部署吗?不,在这种情况下不需要nginx。你能告诉我如何实现吗?对不起,请慢慢来。非常感谢。如果您的局域网只允许通过HTTP代理进行出站连接,那么您不能这样做,我不能在代理后面创建MQTT网桥。是这样吗?