[squid-users] test ICAP server
Robin Wood
squid at digi.ninja
Fri Feb 7 10:15:47 UTC 2025
Hi
I want to write my own ICAP server, but all the sample code I've found is
failing, the majority with this error from squidclient:
squidclient -h 192.168.0.7 -p 1344 icap://192.168.0.7:1344/request_mod
ICAP/1.0 400 Bad Request
And this error when accessed through Squid itself:
ICAP protocol error.
The system returned: [No Error]
This means that some aspect of the ICAP communication failed.
I've got this in my squid.conf:
# Enable ICAP for request and response modification
icap_enable on
icap_service service_req reqmod_precache icap://192.168.0.7:1344/request_mod
icap_service service_resp respmod_precache icap://
192.168.0.7:1344/response_mod
# ICAP adaptation rules
adaptation_access service_req allow all
adaptation_access service_resp allow all
And I've tried running both Python and Ruby servers taken from various
places. A lot are logging that they've received and replied to requests:
Received request: OPTIONS icap://192.168.0.7:1344/request_mod ICAP/1.0
Responded to OPTIONS request
The servers are all listening, I've checked that:
$ ss -antp | grep 1344
LISTEN 0 4096 0.0.0.0:1344
0.0.0.0:* users:(("ruby",pid=563029,fd=5))
The closest I've got is this one:
https://gist.github.com/digininja/a98b3567e0aeb218d37cdd337bb12f34
It seems to be working as it sees the headers and says it has returned data:
Received request: REQMOD icap://192.168.0.7:1344/request_mod ICAP/1.0
Original Headers:
Host: 192.168.0.7:1344
Date: Fri, 07 Feb 2025 10:10:30 GMT
Encapsulated: req-hdr=0, null-body=91
Preview: 0
Allow: 204, trailers
Modified request sent back
But I still get errors.
What could be wrong?
Does someone have some example server code they know works that I can test
to help debug it?
Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-users/attachments/20250207/a30913c9/attachment.htm>
More information about the squid-users
mailing list