Perhaps javascript on the index.html and login.html pages would work for you? That would allow the redirect to happen very quickly.
You can edit those pages in the /theme/ folder in your project directory.
UPDATE:
I think your best bet may be to publish a REST GET endpoint that returns the correct URL. Then add JavaScript <script> tag to index.html with code that hits the rest service and gets the correct URL for the app. If the URL matches, there's nothing to do. If it doesn't match, then you can redirect.