Skip to content

Commit 2637fdc

Browse files
committed
CEXT-3914: Add a webhook option to skip certificate validation
1 parent c0c4fe2 commit 2637fdc

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

src/pages/webhooks/testing.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,47 @@ Responses for a webhook endpoint may be cached if the `ttl` attribute for a hook
5050
```bash
5151
bin/magento cache:clean webhooks_response
5252
```
53+
54+
## Testing webhook endpoint with self-signed SSL certificate
55+
56+
**NOTE**: These options are recommended to use only for development purposes. It's not secure to disable SSL verification in production environments.
57+
58+
If your webhook endpoint uses a self-signed SSL certificate, you can disable SSL verification for the webhook endpoint by setting the `sslVerification` attribute to `false` in the `hook` element.
59+
60+
```xml
61+
<method name="observer.checkout_cart_product_add_before" type="before">
62+
<hooks>
63+
<batch>
64+
<hook name="validate_stock"
65+
url="{env:APP_BUILDER_PROJECT_URL}/product-validate-stock"
66+
sslVerification="false"
67+
>
68+
<fields>
69+
<field name='product.name' source='data.product.name' />
70+
<field name='product.sku' source='data.product.sku' />
71+
</fields>
72+
</hook>
73+
</batch>
74+
</hooks>
75+
</method>
76+
```
77+
78+
Or to specify path to the SSL certificate:
79+
80+
```xml
81+
<method name="observer.checkout_cart_product_add_before" type="before">
82+
<hooks>
83+
<batch>
84+
<hook name="validate_stock"
85+
url="{env:APP_BUILDER_PROJECT_URL}/product-validate-stock"
86+
sslCertificatePath="/path/to/ssl/certificate.pem"
87+
>
88+
<fields>
89+
<field name='product.name' source='data.product.name' />
90+
<field name='product.sku' source='data.product.sku' />
91+
</fields>
92+
</hook>
93+
</batch>
94+
</hooks>
95+
</method>
96+
```

src/pages/webhooks/xml-schema.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ The `hook` element defines the HTTP request to the remote server.
7575
| `fallbackErrorMessage` | Int | The error message to return when the hook fails. | false | Not applicable |
7676
| `remove` | Boolean | Indicates whether to skip a removed hook during the batch execution. | false | false |
7777
| `ttl` | Int | The cache time-to-live (in seconds) for requests with the same URL, body, and headers. If this attribute is not specified, or if the value set to `0`, the response is not cached. | false | 0 |
78+
| `sslVerification` | Boolean | Specifies whether SSL certificate verification would be performed during request. Enabled by default. It's recommended to use this option only for development purposes. | false | true |
79+
| `sslCertificatePath` | String | Specifies the path to a custom SSL certificate file to use for SSL verification. This option will be ignored if sslVerification is set to false. | false | true |
7880
| `headers` | Array | A set of HTTP headers to send with the request. | false | [] |
7981
| `fields` | Array | A set of fields to include in the hook payload. If not set, the entire payload will be sent. | false | [] |
8082

0 commit comments

Comments
 (0)