+3 votes
in Web & Google by (39.4k points)
I am using a CDN to server the static contents of my website. I have enabled "canonical header" to avoid the duplicate content issue with search engines. How can I check the HTTP header of my webpage to verify the "canonical header"?

1 Answer

+3 votes
by (281k points)
selected by
 
Best answer

You can use the curl command with "-I" option. curl is a tool for transferring data from or to a server. With "-I" option, it fetches the headers only.

Here is an example:

curl -I https ://qastatic.bitsdiscover.com/qa-theme/SnowFlat/qa-styles.css?1.8.6
 

The above command returns the following header details:

HTTP/2 200
server: nginx
date: Thu, 18 Aug 2022 22:57:54 GMT
content-type: text/css
content-length: 71469
last-modified: Sat, 08 May 2021 19:46:47 GMT
etag: "6096eaa7-1172d"
expires: Fri, 18 Aug 2023 22:57:54 GMT
cache-control: max-age=31536000
via: PUSHR
link: <https ://www.bitsdiscover.com/qa-theme/SnowFlat/qa-styles.css?1.8.6>; rel="canonical"
access-control-allow-origin: *
access-control-expose-headers: Content-Length
cdn-node: edge-chi.01.pushrcdn.com
cache: HIT
accept-ranges: bytes
 

In the output, you can see that the canonical link points to the original page.

(I have put a space between https and : to make it an unclickable link)


...