Allow setting server mode through environment variable.
Use base url for redirects.