CNAME Dig Results in Unexpected 403 Error

Where I’m doing manual analysis I came across some wired cname configuration?

I have did > dig cname sub[.]target[.]com and get
sub[.]target[.]com cname:www[.]target[.]com

so if I GET sub[.]target[.]com I shoud access the cname resource but it return 403, any explanation?

Regards!

Welcome to webs3c, @Nasreldeen!

Based on the information you provided, it appears that the CNAME record for sub.target.com points to www.target.com. This means that when you try to access sub.target.com, the DNS resolver will follow the CNAME record and resolve it to www.target.com. However, the HTTP response you received was a 403 error, indicating that the server is denying access to the resource.

There could be several reasons why you received a 403 error when trying to access www.target.com. Here are some possible explanations:

It’s possible that the server is configured to redirect requests from sub.target.com to www.target.com, but the server is also configured to only allow access to certain resources from specific domains.

For example, the server may be configured to allow access to the resource from www.target.com but not from sub.target.com. In this case, when you try to access sub.target.com and get redirected to www.target.com, the server will deny access to the resource because the request came from sub.target.com instead of www.target.com.

Another possibility is that the server is using a reverse proxy or load balancer that is intercepting the request and forwarding it to a different backend server. The backend server may be configured to only allow access from certain domains, which could result in a 403 error when you try to access the resource.

Ultimately, the exact reason for the 403 error will depend on the specific server configuration and the resource you’re trying to access.

I hope this answer your question.