Home / Function/ getTrustProxyFn() — fastify Function Reference

getTrustProxyFn() — fastify Function Reference

Architecture documentation for the getTrustProxyFn() function in request.js from the fastify codebase.

Entity Profile

Dependency Diagram

graph TD
  cd8b56ea_67de_c076_301b_e6254e544e9d["getTrustProxyFn()"]
  3043e2d7_25f2_f891_cdeb_063719d4cac2["request.js"]
  cd8b56ea_67de_c076_301b_e6254e544e9d -->|defined in| 3043e2d7_25f2_f891_cdeb_063719d4cac2
  0853a9df_938e_78e1_d709_3314e1b8d395["buildRequestWithTrustProxy()"]
  0853a9df_938e_78e1_d709_3314e1b8d395 -->|calls| cd8b56ea_67de_c076_301b_e6254e544e9d
  style cd8b56ea_67de_c076_301b_e6254e544e9d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/request.js lines 38–56

function getTrustProxyFn (tp) {
  if (typeof tp === 'function') {
    return tp
  }
  if (tp === true) {
    // Support trusting everything
    return null
  }
  if (typeof tp === 'number') {
    // Support trusting hop count
    return function (a, i) { return i < tp }
  }
  if (typeof tp === 'string') {
    // Support comma-separated tps
    const values = tp.split(',').map(it => it.trim())
    return proxyAddr.compile(values)
  }
  return proxyAddr.compile(tp)
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does getTrustProxyFn() do?
getTrustProxyFn() is a function in the fastify codebase, defined in lib/request.js.
Where is getTrustProxyFn() defined?
getTrustProxyFn() is defined in lib/request.js at line 38.
What calls getTrustProxyFn()?
getTrustProxyFn() is called by 1 function(s): buildRequestWithTrustProxy.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free