The A DNS Record requires an IP Address.
This represents your domain without 'www.' i.e. https://example.com
Heroku cannot provide an IP Address since it constantly changes.
They provide urls.
Which is perfect for CNAME Records.
CNAME represents your domain with the www. 'prefix'. i.e. 'https://www.example.com'
But it is an issue for A Records since an IP Address is required.
Meaning if you add the CNAME Record, 'https://www.example.com' will redirect to your Heroku app, but 'https://example.com' will not.
Newer services support CNAME flattening/ALIAS/ANAME.
CNAME flattening/ALIAS/ANAME is the equivalent of being able to add a URL to am A Record instead of an IP Address.
This fixes the issue since you can simply add your Heroku URL.
Hostinger, however, does not support CNAME flattening/ALIAS/ANAME yet.
Another solution is to use DNS Forwarding, but that is also not available on Hostinger unless you move to Clouflare
Hostinger has a "Redirect" section in cPanel but that didn’t work in redirecting 'https://example.com' to 'https://www.example.com' either.
A workaround for all these issues on Hostinger is to add an A Record in DNS Management that points to your Hostinger server IP Address.
In that server we create an .htcaccess file.
And in that file we add code for a permanent 301 redirect to your 'https://www.example.com' (i.e. your Heroku app).
Below is the code that should be added to your .htcaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
The way to get the IP Address of Hostinger to point to that .htcaccess file is by checking the left panel inside the cPanel or going into Details section.
You can show this to your Hostinger support in the chat section and they can do it for you.