Doing curl test for incoming webhook returns 403 error

Summary

Doing curl test for incoming webhook returns 403 error.

Steps to reproduce

0.Follow this guide https://docs.mattermost.com/developer/webhooks-incoming.html
1.Create incoming webhook
2.Run this command:

curl -i -X POST -H ‘Content-Type: application/json’ -d ‘{“text”: “Hello, this is some text\nThis is more text. :tada:”}’ http://172.28.64.51:8065/hooks/wdohzcuksjrgurb614gdk79zoc

Expected behavior

Should be successed…

Observed behavior

Return:

HTTP/1.1 403 Forbidden
Server: squid
Mime-Version: 1.0
Date: Thu, 05 Apr 2018 17:10:00 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 2062
X-Squid-Error: ERR_ACCESS_DENIED 0
Vary: Accept-Language
Content-Language: en
X-Cache: MISS from proxy-2_10
Via: 1.1 proxy-2_10:8010
Proxy-Connection: close

Web Page Cannot Be Displayed

Hi there,

It looks like you have a Squid proxy between you and the Mattermost server you’re trying to access that you’ll need to authenticate with before you can get to the server. Here’s a good resource on how to use curl to do this.

Thanks for your reply!
This error happens on localhost. Everything’s ok when I test from an other machine.
But, I still have no idea with:
Why squid? Why does squied need my auth? Acutally, I don’t even remember installing it. (Typing ‘squid’ in Terminal shows apt-get suggestion)

It seems that I have figured out what the problem is.
Just add a --noproxy parameter on curl command can fix the problem.

~$ curl –noproxy “*” -i -X POST --data-urlencode ‘payload={“text”: “Hello, this is some text\nThis is more text. :t
ada:”}’ http://172.28.64.51:8065/hooks/wdohzcuksjrgurb614gdk79zoc
HTTP/1.1 200 OK
Access-Control-Allow-Origin:
Content-Type: text/plain
X-Request-Id: 3nbkz4j63ff7upnuhfm6w6ppbh
X-Version-Id: 4.8.0.4.8.0.d39da9993707366832c9a9108a647ef3.false
Date: Sat, 07 Apr 2018 15:20:56 GMT
Content-Length: 2

But still have no idea about the blocking behavior of Squid. Can I think of that CURL uses Squid to process proxy ? :neutral_face:

Finally, adding no_proxy setting to my /etc/environment sloved the problem.

For me curl Working fine, But when I use same url to trigger jenkins through bitbucket webhook it returning as below.

Headers

X-Cache MISS from ip-10-18-21-75.us-west-2.compute.internal
Server squid
Connection keep-alive
X-Squid-Error ERR_ACCESS_DENIED 0
Vary Accept-Language
Mime-Version 1.0
Content-Length 3169
Date Thu, 22 Feb 2024 07:21:56 GMT
Content-Language en
Content-Type text/html;charset=utf-8
Via 1.1 ip-10-18-21-75.us-west-2.compute.internal (squid)