Log auth errors
Use javascript to do redirects.

This way hash (#) based routing will be preserved also. Kibana uses it
for example.
preserve targe hostname