canonical 1 - http header

LINK

According to Google you can set the canonical URL for non-HTML documents in the http header. Consider the following example:
Link: <https://valentin.app/noindex/canonical1.html>; rel="canonical"

Google Search Console URL Inspection will declare this URL can be indexed which is in line with the specifications.