directSchemeOf static method

String directSchemeOf(
  1. HttpRequest req
)

The scheme of req with no trusted proxy in front: https when the port it came on has TLS, else http. An app can have plain and TLS ports together (AppConfig.ports), so the port decides.

Implementation

static String directSchemeOf(HttpRequest req) {
  if (req is NativeRequest) return req.server.tls == null ? 'http' : 'https';
  return directScheme;
}