MCPcopy Create free account
hub / github.com/coder/mux / getPreferredPublicProtocol

Function getPreferredPublicProtocol

src/node/orpc/server.ts:306–318  ·  view source on GitHub ↗
(
  req: OriginValidationRequest,
  allowHttpOrigin = false
)

Source from the content-addressed store, hash-verified

304}
305
306function getPreferredPublicProtocol(
307 req: OriginValidationRequest,
308 allowHttpOrigin = false
309): "http" | "https" {
310 const clientFacingProtocol = getClientFacingProtocol(req);
311 const originProtocol = getOriginProtocolOnExpectedHost(req);
312
313 if (allowHttpOrigin && clientFacingProtocol === "http" && originProtocol === "https") {
314 return "https";
315 }
316
317 return clientFacingProtocol;
318}
319
320function getExpectedOrigins(req: OriginValidationRequest, allowHttpOrigin = false): string[] {
321 const hosts = getExpectedHosts(req);

Callers 2

buildPublicAbsoluteUrlFunction · 0.85
isSecureRequestFunction · 0.85

Calls 2

getClientFacingProtocolFunction · 0.85

Tested by

no test coverage detected