Skip to content

Commit 224d356

Browse files
authored
Merge pull request AdobeDocs#295 from oshmyheliuk/CEXT-3914
CEXT-3914: Add a webhook option to skip certificate validation
2 parents 3c5d324 + be9f328 commit 224d356

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/pages/webhooks/testing.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,49 @@ 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+
<InlineAlert variant="info" slots="text1" />
57+
58+
SSL verification should be not be disabled in production environments. These options are recommended for development purposes only.
59+
60+
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.
61+
62+
```xml
63+
<method name="observer.checkout_cart_product_add_before" type="before">
64+
<hooks>
65+
<batch>
66+
<hook name="validate_stock"
67+
url="{env:APP_BUILDER_PROJECT_URL}/product-validate-stock"
68+
sslVerification="false"
69+
>
70+
<fields>
71+
<field name='product.name' source='data.product.name' />
72+
<field name='product.sku' source='data.product.sku' />
73+
</fields>
74+
</hook>
75+
</batch>
76+
</hooks>
77+
</method>
78+
```
79+
80+
Or, to specify the path to the SSL certificate:
81+
82+
```xml
83+
<method name="observer.checkout_cart_product_add_before" type="before">
84+
<hooks>
85+
<batch>
86+
<hook name="validate_stock"
87+
url="{env:APP_BUILDER_PROJECT_URL}/product-validate-stock"
88+
sslCertificatePath="/path/to/ssl/certificate.pem"
89+
>
90+
<fields>
91+
<field name='product.name' source='data.product.name' />
92+
<field name='product.sku' source='data.product.sku' />
93+
</fields>
94+
</hook>
95+
</batch>
96+
</hooks>
97+
</method>
98+
```

src/pages/webhooks/xml-schema.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ The `hook` element defines the HTTP request to the remote server.
7878
| `fallbackErrorMessage` | Int | The error message to return when the hook fails. | false | Not applicable |
7979
| `remove` | Boolean | Indicates whether to skip a removed hook during the batch execution. | false | false |
8080
| `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 |
81+
| `sslVerification` | Boolean | Specifies whether SSL certificate verification would be performed during request. Enabled by default. This option should only be used for development purposes. | false | true |
82+
| `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 | Not applicable |
8183
| `headers` | Array | A set of HTTP headers to send with the request. | false | [] |
8284
| `fields` | Array | A set of fields to include in the hook payload. If not set, the entire payload will be sent. | false | [] |
8385

0 commit comments

Comments
 (0)