To avoid that you're getting a security page were the user requires to click like this:



You need to run the following PowerShell code once in your farm:

(Get-SPFarm).properties["CustomAppRedirect"] = $true

(Get-SPFarm).Update()