You should use server.getApplicationURL for this (we may eventually need to inject additional URL parameters e.g. to support multiple concurrent sessions in server mode)