We found out that starting from Confluence 8.4 we could not define application links to Jira in the local environment (when the hostname pointed to a localhost address). The following error message was shown:
URL must not point to localhost or restricted IPs.
After long debugging, we found out that this could be fixed by adding a Java property
It seems that this property was adding starting from Applinks 9.1 which is used in the latest Confluence versions but not yet in Jira.
This property is mentioned in Recognized System Properties | Confluence Data Center and Server 8.4 | Atlassian Documentation but didn’t see it mentioned in any release notes.
So if you are testing applicaiton links locally this might help you.