# EMQ X Broker 生产部署 文档上ssl打到lb的方式部署方案有详细的么

**URL:** <https://askemq.com/t/topic/987>\
**Category:** EMQX\
**Created:** [2021 年9 月 17 日 05:16 UTC](https://askemq.com/t/topic/987 "2021-09-17T05:16:14Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

作者： ![1198395447](https://askemq.com/letter_avatar/1198395447/32/6_449c533f586939b6e5f246632a46421f.png) [@1198395447](https://askemq.com/u/1198395447)\
发布日期： [2021 年9 月 17 日 05:16 UTC](https://askemq.com/t/topic/987/1 "2021-09-17T05:16:14Z")

</div>

### 问题描述

emqx 配置webHook 响应失败 日志报错404

### 环境信息

- EMQ X 版本：4.3.1
- 操作系统及版本：centos 3.10.0-1160.11.1.el7.x86\_64  
-Erlang/OTP 版本：23.2.7.2-emqx-2/11.1.8
- 其他

### 相应的配置文件内容

```auto
## Webhook URL
##
## Value: String
web.hook.url = http://ali-test.puhuiboss.com/api/iot/mqtt/webHook
#
====================================================================
## WebHook
##====================================================================

## Webhook URL
##
## Value: String
web.hook.url = http://ali-test.puhuiboss.com/api/iot/mqtt/webHook

## HTTP Headers
##
## Example:
## 1. web.hook.headers.content-type = application/json
## 2. web.hook.headers.accept = *
##
## Value: String
web.hook.headers.content-type = application/json

##====================================================================

## Webhook URL
##
## Value: String
web.hook.url = http://ali-test.puhuiboss.com/api/iot/mqtt/webHook

## HTTP Headers
##
## Example:
## 1. web.hook.headers.content-type = application/json
## 2. web.hook.headers.accept = *
##
## Value: String
web.hook.headers.content-type = application/json

## The encoding format of the payload field in the HTTP body
## The payload field only appears in the on_message_publish and on_message_delivered actions
##
## Value: plain | base64 | base62
web.hook.body.encoding_of_payload_field = plain

##--------------------------------------------------------------------
## PEM format file of CA's
##
## Value: File
## web.hook.ssl.cacertfile = <PEM format file of CA's>

## Certificate file to use, PEM format assumed
##
## Value: File
## web.hook.ssl.certfile = <Certificate file to use>

## Private key file to use, PEM format assumed
##
## Value: File
## web.hook.ssl.keyfile = <Private key file to use>
## Turn on peer certificate verification
##
## Value: true | false
## web.hook.ssl.verify = false

## If not specified, the server's names returned in server's certificate is validated against
## what's provided `web.hook.url` config's host part.
## Setting to 'disable' will make EMQ X ignore unmatched server names.
## If set with a host name, the server's names returned in server's certificate is validated
## against this value.
##
## Value: String | disable
## web.hook.ssl.server_name_indication = disable

## Connection process pool size
##
## Value: Number
web.hook.pool_size = 32

##--------------------------------------------------------------------
## Hook Rules
## These configuration items represent a list of events should be forwarded
##
## Format:
## web.hook.rule.<HookName>.<No> = <Spec>
web.hook.rule.client.connect.1 = {"action": "on_client_connect"}
web.hook.rule.client.connack.1 = {"action": "on_client_connack"}
web.hook.rule.client.connected.1 = {"action": "on_client_connected"}
web.hook.rule.client.disconnected.1 = {"action": "on_client_disconnected"}
web.hook.rule.client.subscribe.1 = {"action": "on_client_subscribe"}
web.hook.rule.client.unsubscribe.1 = {"action": "on_client_unsubscribe"}
web.hook.rule.session.subscribed.1 = {"action": "on_session_subscribed"}
web.hook.rule.session.unsubscribed.1 = {"action": "on_session_unsubscribed"}
web.hook.rule.session.terminated.1 = {"action": "on_session_terminated"}
web.hook.rule.message.publish.1 = {"action": "on_message_publish"}
web.hook.rule.message.delivered.1 = {"action": "on_message_delivered"}
web.hook.rule.message.acked.1 = {"action": "on_message_acked"}

```

### 详细日志

 ![image](https://askemq.com/uploads/default/original/1X/238049c41a9f065f705233700c6114e846dab5d3.png)

### 相关截图

 ![image](https://askemq.com/uploads/default/original/1X/5672a05bfc46a7675d3d8b79a1fe0e421ff2eeab.png)

---

<div class="post-metadata">

作者： ![t1ger](https://askemq.com/user_avatar/askemq.com/t1ger/32/89_2.png) [@t1ger](https://askemq.com/u/t1ger)\
发布日期： [2021 年9 月 17 日 06:56 UTC](https://askemq.com/t/topic/987/2 "2021-09-17T06:56:34Z")

</div>

你好，麻烦确认下配置的 URL 有没有问题呢。

---

<div class="post-metadata">

作者： ![1198395447](https://askemq.com/letter_avatar/1198395447/32/6_449c533f586939b6e5f246632a46421f.png) [@1198395447](https://askemq.com/u/1198395447)\
发布日期： [2021 年9 月 17 日 10:06 UTC](https://askemq.com/t/topic/987/3 "2021-09-17T10:06:01Z")

</div>

好的谢谢

 ![image](https://askemq.com/uploads/default/original/1X/5119ba0848999f55aab831d1ffdf5528b215b196.png)  
我在 部署mqtt的服务器上能请求这个接口的，接口是能通的  
我尝试了下 我用docker 方式部署，rpm包 和和4.3.1版本的和4.3.5版本的zip包部署 都是报这个错，大概是这个配置url的问题，可是这个 404的状态码就不明白了

---

<div class="post-metadata">

作者： ![t1ger](https://askemq.com/user_avatar/askemq.com/t1ger/32/89_2.png) [@t1ger](https://askemq.com/u/t1ger)\
发布日期： [2021 年9 月 18 日 01:05 UTC](https://askemq.com/t/topic/987/4 "2021-09-18T01:05:06Z")

</div>

这样的话，最好能够抓包看下

---

<div class="post-metadata">

作者： ![bagpipes](https://askemq.com/user_avatar/askemq.com/bagpipes/32/911_2.png) [@bagpipes](https://askemq.com/u/bagpipes)\
发布日期： [2021 年9 月 18 日 01:09 UTC](https://askemq.com/t/topic/987/5 "2021-09-18T01:09:43Z")

</div>

[http://ali-test.puhuiboss.com/api/iot/mqtt/webHook](http://ali-test.puhuiboss.com/api/iot/mqtt/webHook) 这个服务是你自己的吧，你请求回来的都是有问题啊，你框选的那部分是虽然返回内容，但是也是错误的内容返回。

---

<div class="post-metadata">

作者： ![1198395447](https://askemq.com/letter_avatar/1198395447/32/6_449c533f586939b6e5f246632a46421f.png) [@1198395447](https://askemq.com/u/1198395447)\
发布日期： [2021 年9 月 18 日 01:30 UTC](https://askemq.com/t/topic/987/6 "2021-09-18T01:30:59Z")

</div>

好的

---

<div class="post-metadata">

作者： ![1198395447](https://askemq.com/letter_avatar/1198395447/32/6_449c533f586939b6e5f246632a46421f.png) [@1198395447](https://askemq.com/u/1198395447)\
发布日期： [2021 年9 月 18 日 01:31 UTC](https://askemq.com/t/topic/987/7 "2021-09-18T01:31:32Z")

</div>

是的接口是通的

---

<div class="post-metadata">

作者： ![bagpipes](https://askemq.com/user_avatar/askemq.com/bagpipes/32/911_2.png) [@bagpipes](https://askemq.com/u/bagpipes)\
发布日期： [2021 年9 月 18 日 01:33 UTC](https://askemq.com/t/topic/987/8 "2021-09-18T01:33:32Z")

</div>

接口通，但是返回内容是有问题，你先抛开emqx，调试你的返回内容为啥是错误

---

<div class="post-metadata">

作者： ![bagpipes](https://askemq.com/user_avatar/askemq.com/bagpipes/32/911_2.png) [@bagpipes](https://askemq.com/u/bagpipes)\
发布日期： [2021 年9 月 18 日 07:43 UTC](https://askemq.com/t/topic/987/9 "2021-09-18T07:43:07Z")

</div>

问题解了吗

---

<div class="post-metadata">

作者： ![1198395447](https://askemq.com/letter_avatar/1198395447/32/6_449c533f586939b6e5f246632a46421f.png) [@1198395447](https://askemq.com/u/1198395447)\
发布日期： [2021 年9 月 18 日 08:06 UTC](https://askemq.com/t/topic/987/10 "2021-09-18T08:06:46Z")

</div>

没有 但我用官方指导的docker 部署方式 重新部署了4.0.0 的版本通了，配置url也是同一个，之前crul那个接口报错是传递参数问题。

这个是docker的日志，显示的有failed 可我的接口是收到的链接断开事件，我那配置url还是同样的，没改什么，只是用docker部署了4.0.0的版本， 4.0.0版本的路径key是 web.hook.api.url

 ![image](https://askemq.com/uploads/default/original/1X/ebb9b45fcb94f1081b465497e9e7a63e3d347d2d.png)

---

<div class="post-metadata">

作者： ![bagpipes](https://askemq.com/user_avatar/askemq.com/bagpipes/32/911_2.png) [@bagpipes](https://askemq.com/u/bagpipes)\
发布日期： [2021 年9 月 18 日 08:22 UTC](https://askemq.com/t/topic/987/11 "2021-09-18T08:22:40Z")

</div>

建议你在你那台机器上直接部署，先验证排出是不是外部其他原因。如果仅仅是用docker不成功，那在你docker里，直接ping你的网是否通的。额外问一下，你这个web hook你感觉搞错了吧，这个跟你外部参数没多大关系，每个aciton都是定义好的格式，要不再看一下这个概念https://docs.emqx.cn/broker/v4.3/advanced/webhook.html

---

<div class="post-metadata">

作者： ![1198395447](https://askemq.com/letter_avatar/1198395447/32/6_449c533f586939b6e5f246632a46421f.png) [@1198395447](https://askemq.com/u/1198395447)\
发布日期： [2021 年9 月 18 日 08:36 UTC](https://askemq.com/t/topic/987/12 "2021-09-18T08:36:33Z")

</div>

好的 ，十分谢谢 👍 ， 我在研究下
