-
Type:
Bug
-
Resolution: Timed out
-
Priority:
Medium
-
Component/s: Ecosystem
-
Severity 3 - Minor
Issue Summary
Confluence webhooks do not include charset=utf-8 encoding with the Content-Type: header, which causes errors during payload parsing. A standard Spring Boot application fails with the following error.
JSON parse error: Invalid UTF-8 start byte 0xfc]
The same webhook listener client works fine for Jira webhooks, which by default include the header Content-Type: application/json; charset=utf-8
Steps to Reproduce
- Create a Spring Boot application and implement
@RestController public class WebhookController { @PostMapping(value="/webhook") public ResponseEntity<String> listenToWebhook(@RequestBody JsonNode requestBody) { // Log the incoming webhook payload for debugging System.out.println("Received webhook payload: " + requestBody.toString()); } }
- Run the Spring Boot application
- Create a webhook using the rest API /rest/webhooks/1.0/webhook
{ "name": "Confluence_Webhook_test", "url": "https://<your service domainname>/webhook", "events": [ "page_removed", "page_trashed" ] } - Create a page with the title "test ü".
- Delete the page.
Expected Results
The webhook events include the correct Content-Type: header, including the charset.
Content-Type: application/json; charset=UTF-8
Actual Results
The webhook events do not include the correct Content-Type: header, including the charset.
Content-Type: application/json
Workaround
Create a Custom Filter:
- Implement the javax.servlet.Filter interface.
- Override the doFilter method to intercept incoming requests.
- Inside the doFilter method:
- Access the request character encoding using request.getCharacterEncoding().
- If it's null or not UTF-8, set the encoding to UTF-8 using request.setCharacterEncoding("UTF-8").
- blocks
-
ECOHELP-42494 Loading...
- mentioned in
-
Page Loading...