SOLVED cURL: TCP Connection reset by Peer

ankeshanand

Well-Known Member
Mar 29, 2021
194
58
103
India
cPanel Access Level
Root Administrator
I am currently trying to repair a cPanel Server. There is a cURL Error only on Internal Websites hosted by the Server.

On the outside network, cURL works fine but if we cURL Internally, like curl whatever.com:443 or curl https://whatever.com , Its connection is reset.(Whatever.com is hosted on the same server)

The Server currently runs on Litespeed. Any Idea how to resolve this error? (All Server PHP Modules are updated from EA4 and Server is on Version 96. cURL is also updated)
 
  • Like
Reactions: hmaddy

kodeslogic

Well-Known Member
Apr 26, 2020
331
126
118
IN
cPanel Access Level
Root Administrator
Can you paste the output for the below commands from another machine and from the server hosting this domain ifself:

Code:
#curl -vvv  http://whatever.com
#curl -vvv  https://whatever.com
 

ankeshanand

Well-Known Member
Mar 29, 2021
194
58
103
India
cPanel Access Level
Root Administrator
Can you paste the output for the below commands from another machine and from the server hosting this domain ifself:

Code:
#curl -vvv  http://whatever.com
#curl -vvv  https://whatever.com
Code:
[[email protected] ~]# curl whatever.com
curl: (56) Recv failure: Connection reset by peer
[[email protected] ~]# curl whatever.com:443
curl: (56) Recv failure: Connection reset by peer
[[email protected] ~]# curl http://whatever.com
curl: (56) Recv failure: Connection reset by peer
[[email protected] ~]# curl https://whatever.com
curl: (56) Recv failure: Connection reset by peer

[[email protected] ~]# curl -vvv whatever.com
* About to connect() to aback.in port 80 (#0)
*   Trying x.x.x.x...
* Connected to whatever.com (x.x.x.x) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: whatever.com
> Accept: */*
>
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
Tried everything but this seems to be the issue with Litespeed in cPanel Only. Litespeed is also working!

  • LiteSpeed is running (PID = 3303271, Apache_Port_Offset = 0). Apache is not running.
Normal HTTP and HTTPS requests work correctly and cURL from Remote Machines also do work but only Internally, cURL is having problems in Hosted Websites on the server.
 

ankeshanand

Well-Known Member
Mar 29, 2021
194
58
103
India
cPanel Access Level
Root Administrator
Problem Solved.
The Anti-DDOS Blocked IP in Litespeed WebServer was blocking 127.0.0.1 and Server's Public IP Address. Checked it from Real-Time Stats in Webadmin Console.

The Problem is in Litespeed Server. Their Default Configuration in Access Control List(Trusted IP) is as follows:
Code:
127.0.0.1, ALL, (My Server IP)
The Configuration should be:
Code:
127.0.0.1T,ALL, (My Server IP)T
The Trailing T stands for Trusted which created all the difference.
 
  • Like
Reactions: cPRex