Curl command getting 403 in my subdomain

I am using curl in my cron job. Two cron job, the first one is for root domain and the second one is for sub-domain.

The First Cron job which is for root domain is working, but the second Cron job (for sub-domain).is not working. It returning 403 Forbidden. I have tried from the Cpanel terminal.

[[email protected] ~]$ curl https://sub.domain.com
<!DOCTYPE html>
<html style="height:100%">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title> 403 Forbidden
</title></head>
<body style="color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;">
<div style="height:auto; min-height:100%; "> <div style="text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;">
<h1 style="margin:0; font-size:150px; line-height:150px; font-weight:bold;">403</h1>
<h2 style="margin-top:20px;font-size: 30px;">Forbidden
</h2>
<p>Access to this resource on the server is denied!</p>
</div></div><script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"rayId":"685e8cfe8c7aedeb","version":"2021.8.1","r":1,"token":"ae55d96bddd34ef0b2933fd48fcd9d3e","si":10}'></script>
</body></html>
[[email protected] ~]$
[[email protected] ~]$ curl -svo /dev/null https://sub.domain.com
About to connect() to sub.domain.com port 443 (#0)
  Trying (***.**.***.***...
Connected to sub.domain.com (***.**.***.***) port 443 (#0)
Initializing NSS with certpath: sql:/etc/pki/nssdb
  CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
Server certificate:
      subject: CN=sni.cloudflaressl.com,O="Cloudflare, Inc.",L=San Francisco,ST=California,C=US
      start date: Apr 02 00:00:00 2021 GMT
      expire date: Apr 01 23:59:59 2022 GMT
      common name: sni.cloudflaressl.com
      issuer: CN=Cloudflare Inc ECC CA-3,O="Cloudflare, Inc.",C=US
GET / HTTP/1.1
User-Agent: curl/7.29.0
Host: sub.domain.com
Accept: */*
HTTP/1.1 403 Forbidden
Date: Sat, 28 Aug 2021 15:27:54 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
cache-control: private, no-cache, no-store, must-revalidate, max-age=0
pragma: no-cache
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=y62b7kLt2AgjoMf1SSfTbH1S4sqtOOBxAEmgURPMGzhaZoQwVV4SBB2ATEPXc3TK3g%2F0%2F%2BLXwUC5FTI3C0J4hnqpvUeQfxO4CwyEMQvNsCLloIMxb2tikfnMeOekpJQAPOg0ppOdgsXh0QFi"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Strict-Transport-Security: max-age=2592000; includeSubDomains; preload
Server: cloudflare
CF-RAY: 685e90fc4da04c67-AMS
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400
<
{ [data not shown]
* Connection #0 to host sub.domain.com left intact
[[email protected] ~]$

Why it’s happening and how to solve this?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.