I Loop Detection and Loop Prevention in NRF Forwarding Scenarios

NRF forwarding may involve multiple NRFs. Since nrfHostConfig defines the NRF peers used for forwarding, NRF also uses it together with the Via header (forwarding history) to ensure that forwarded requests do not circulate between NRFs.

The following sections describes the behavior of loop detection and loop prevention for NRF forwarding in the following modes:
  • NRF forwarding : URI- {apiRoot}/nrf-configuration/v1/forwardingOptions
  • NRF Growth forwarding: URI- {apiRoot}/nrf-configuration/v1/nrfGrowth/nrfForwardingOptions

Loop detection

Loop detection stops a request when it has been forwarded in a circle and returns to the same NRF endpoint. NRF checks the Via header and if it contains the current NRF host and port, NRF declares a loop and returns an error response as configured under errorResponses for errorCondition=NRF_Forwarding_Loop_Detection.

Example:
  • NRF forwarding: NRF-A forwards a request to NRF-B. Due to routing or configuration issues, NRF-B forwards the same request back to NRF-A. When NRF-A receives it again, the Via header already contains NRF-A host:port, so NRF-A detects a loop and returns the configured error (for example, HTTP 508 “Loop Detected”).
  • NRF Growth forwarding: NRF-A forwards a request from the NRF set-1 to another NRF (NRF-E) in the NRF set-2 based on Growth forwarding configuration. Due to routing or configuration issues, the request is forwarded back to the original NRF (NRF-A) in the first NRF set (NRF set-1). When the original NRF (NRF-A in NRF set-1) receives it again, the Via header already contains the original NRF (NRF-A in NRF set-1) host:port, so it detects a loop and returns the configured error (for example, HTTP 508 “Loop Detected”).

Loop prevention

Loop prevention avoids repeated forwarding by ensuring NRF does not forward a request that is already forwarded. NRF compares the Via header against configured NRF identities in nrfHostConfig; if it matches, NRF treats the request as already forwarded and does not forward it again.

Example:
  • NRF forwarding: A request reaches an NRF with a Via header entry that matches a configured host:port in nrfHostConfig. NRF treats the request as already forwarded and does not forward it again.
  • NRF Growth forwarding: A request reaches an NRF with a Via header entry that matches a configured host:port under nrfHostConfig.staticNrfConfigList[].nrfHostConfigList[]. NRF treats the request as already forwarded and does not forward it again.