Hi there!
Welcome back to the Auth0 Community!
Thank you for posting your question. Your condition statement is ok, but the reason why it’s not working may be due to the full URL format that includes the protocol (e.g., http://localhost or https://localhost. Try to edit your condition to this:
http://localhost
https://localhost
{% if application.callback_domain contains 'localhost' %} https://localhost:3001 {% else %} {{ application.callback_domain }} {% endif %}
Thanks Dawid