Bitbucket Server webhooks cannot be added due to Syntax or http error
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Post-Receive webhooks cannot be added when using IIS proxies.
The following appears in the atlassian-bitbucket
.log:
Syntax or http error: /s/71095c56c641f2c4a4f189b9dfcd7a38-T/en_US/3619e0d/1/127ae82fe7ed82b6d279c6233630ef0d/_/download/contextbatch/js/com.atlassian.stash.plugin.stash-web-post-receive-hooks-plugin:postReceiveHook-config-form,-bitbucket.layout.repositorySettings,-bitbucket.page.repository.settings.hooks,-bitbucket.layout.entity,-_super,-bitbucket.layout.repository,-bitbucket.layout.base,-atl.general/batch.js?locale=en-US
Diagnosis
Diagnostic Steps
To confirm that the problem is related to the reverse proxy, follow the steps on How do I bypass a proxy for Bitbucket Server and attempt to add the webhook through the non-proxied port.
If the webhook can successfully be added, the proxy configuration is preventing to add it when the call is directed through it.
Cause
IIS proxies do not correctly handle colon (:)
in URLs before the question mark (?).
The URL reported in the error contains one as shown in the snippet below:
com.atlassian.stash.plugin.stash-web-post-receive-hooks-plugin:postReceiveHook-config-form
Resolution
As mentioned on the IIS forum, the problem can be resolved by running the Application Pool .NET4 instead of .NET2.