{"modulePath":"github.com/CrisisTextLine/modular/modules/reverseproxy/v2","version":"v2.4.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package reverseproxy\n\nPackage reverseproxy provides circuit breaker implementation for backend proxies.\n\nPackage reverseproxy provides a flexible reverse proxy module with support for multiple backends, composite responses, and tenant awareness.\n\nPackage reverseproxy provides configuration structures for the reverse proxy module.\n\nPackage reverseproxy provides error definitions for the reverse proxy module.\n\nPackage reverseproxy provides metrics collection for the reverse proxy module.\n\nPackage reverseproxy provides a flexible reverse proxy module with support for multiple backends, composite responses, and tenant awareness.\n\nPackage reverseproxy provides retry functionality for the reverse proxy module.\n\nPackage reverseproxy provides a flexible reverse proxy module with support for multiple backends, composite responses, and tenant awareness.\n\n## Constants\n\n```go\nconst (\n\t// Configuration events\n\tEventTypeConfigLoaded    = \"com.modular.reverseproxy.config.loaded\"\n\tEventTypeConfigValidated = \"com.modular.reverseproxy.config.validated\"\n\n\t// Proxy events\n\tEventTypeProxyCreated = \"com.modular.reverseproxy.proxy.created\"\n\tEventTypeProxyStarted = \"com.modular.reverseproxy.proxy.started\"\n\tEventTypeProxyStopped = \"com.modular.reverseproxy.proxy.stopped\"\n\n\t// Request events\n\tEventTypeRequestReceived  = \"com.modular.reverseproxy.request.received\"\n\tEventTypeRequestProxied   = \"com.modular.reverseproxy.request.proxied\"\n\tEventTypeRequestFailed    = \"com.modular.reverseproxy.request.failed\"\n\tEventTypeRequestProcessed = \"com.modular.reverseproxy.request.processed\"\n\n\t// Dry-run events\n\tEventTypeDryRunComparison = \"com.modular.reverseproxy.dryrun.comparison\"\n\n\t// Backend events\n\tEventTypeBackendHealthy   = \"com.modular.reverseproxy.backend.healthy\"\n\tEventTypeBackendUnhealthy = \"com.modular.reverseproxy.backend.unhealthy\"\n\tEventTypeBackendAdded     = \"com.modular.reverseproxy.backend.added\"\n\tEventTypeBackendRemoved   = \"com.modular.reverseproxy.backend.removed\"\n\n\t// Load balancing events\n\tEventTypeLoadBalanceDecision   = \"com.modular.reverseproxy.loadbalance.decision\"\n\tEventTypeLoadBalanceRoundRobin = \"com.modular.reverseproxy.loadbalance.roundrobin\"\n\n\t// Circuit breaker events\n\tEventTypeCircuitBreakerOpen     = \"com.modular.reverseproxy.circuitbreaker.open\"\n\tEventTypeCircuitBreakerClosed   = \"com.modular.reverseproxy.circuitbreaker.closed\"\n\tEventTypeCircuitBreakerHalfOpen = \"com.modular.reverseproxy.circuitbreaker.halfopen\"\n\n\t// Module lifecycle events\n\tEventTypeModuleStarted = \"com.modular.reverseproxy.module.started\"\n\tEventTypeModuleStopped = \"com.modular.reverseproxy.module.stopped\"\n\n\t// Error events\n\tEventTypeError = \"com.modular.reverseproxy.error\"\n)\n```\nEvent type constants for reverseproxy module events. Following CloudEvents specification reverse domain notation.\n\n## Variables\n\n```go\nvar (\n\t// ErrCircuitOpen defined in circuit_breaker.go\n\tErrMaxRetriesReached               = errors.New(\"maximum number of retries reached\")\n\tErrRequestTimeout                  = errors.New(\"request timed out\")\n\tErrNoAvailableBackend              = errors.New(\"no available backend\")\n\tErrBackendServiceNotFound          = errors.New(\"backend service not found\")\n\tErrConfigurationNil                = errors.New(\"configuration is nil\")\n\tErrDefaultBackendNotDefined        = errors.New(\"default backend is not defined in backend_services\")\n\tErrTenantIDRequired                = errors.New(\"tenant ID is required but TenantIDHeader is not set\")\n\tErrServiceNotHandleFunc            = errors.New(\"service does not implement HandleFunc interface\")\n\tErrCannotRegisterRoutes            = errors.New(\"cannot register routes: router is nil\")\n\tErrBackendNotFound                 = errors.New(\"backend not found\")\n\tErrBackendProxyNil                 = errors.New(\"backend proxy is nil\")\n\tErrFeatureFlagNotFound             = errors.New(\"feature flag not found\")\n\tErrDryRunModeNotEnabled            = errors.New(\"dry-run mode is not enabled\")\n\tErrApplicationNil                  = errors.New(\"app cannot be nil\")\n\tErrLoggerNil                       = errors.New(\"logger cannot be nil\")\n\tErrTenantAwareConfigCreation       = errors.New(\"failed to create tenant-aware config for feature flags\")\n\tErrInvalidFeatureFlagConfigType    = errors.New(\"invalid feature flag configuration type\")\n\tErrNoFeatureFlagConfigProvider     = errors.New(\"no configuration provider available for feature flags\")\n\tErrInvalidDefaultFeatureFlagConfig = errors.New(\"invalid default configuration type for feature flags\")\n\tErrConfigurationNotLoaded          = errors.New(\"configuration not loaded\")\n\tErrBackendErrorStatus              = errors.New(\"backend returned non-success status\")\n\n\t// Feature flag evaluation sentinel errors\n\tErrNoDecision     = errors.New(\"no-decision\")     // Evaluator abstains from making a decision\n\tErrEvaluatorFatal = errors.New(\"evaluator-fatal\") // Fatal error that should abort evaluation chain\n\n\t// Feature flag aggregator errors\n\tErrNoEvaluatorsAvailable = errors.New(\"no feature flag evaluators available\")\n\tErrNoEvaluatorDecision   = errors.New(\"no evaluator provided decision for flag\")\n\n\t// Event observation errors\n\tErrNoSubjectForEventEmission = errors.New(\"no subject available for event emission\")\n\n\t// Dynamic operation errors\n\tErrBackendIDRequired    = errors.New(\"backend id required\")\n\tErrServiceURLRequired   = errors.New(\"service URL required\")\n\tErrNoBackendsConfigured = errors.New(\"no backends configured\")\n\tErrBackendNotConfigured = errors.New(\"backend not configured\")\n)\n```\nError definitions for the reverse proxy module.\n\n```go\nvar (\n\t// ErrCircuitOpen is returned when the circuit is open and requests are not allowed.\n\tErrCircuitOpen = errors.New(\"circuit breaker is open\")\n)\n```\n\n```go\nvar ErrNoHostname = errors.New(\"no hostname in URL\")\n```\nErrNoHostname is returned when a URL has no hostname\n\n```go\nvar ErrUnexpectedConfigType = errors.New(\"unexpected config type\")\n```\nErrUnexpectedConfigType is returned when an unexpected config type is passed to Init\n\n```go\nvar ErrUnexpectedStatusCode = errors.New(\"unexpected status code\")\n```\nErrUnexpectedStatusCode is returned when a health check receives an unexpected status code\n\n## Functions\n\n```go\nfunc ProvideConfig() interface{}\n```\nProvideConfig creates a new default configuration for the reverseproxy module. This is used by the modular framework to register the configuration.\n\n```go\nfunc RetryWithPolicy(ctx context.Context, policy RetryPolicy, fn RetryFunc, metrics *MetricsCollector, backendID string) (interface{}, int, error)\n```\nRetryWithPolicy executes the given function with retries according to the policy.\n\n```go\nfunc TenantIDFromRequest(tenantHeader string, r *http.Request) (string, bool)\n```\nTenantIDFromRequest extracts tenant ID from the request header\n\n## Types\n\n```go\ntype Backend struct {\n\tID     string\n\tURL    string\n\tClient *http.Client\n}\n```\nBackend represents a backend service configuration.\n\n```go\ntype BackendCircuitBreakerConfig struct {\n\tEnabled          bool          `json:\"enabled\" yaml:\"enabled\" toml:\"enabled\" env:\"ENABLED\" default:\"false\" desc:\"Enable circuit breaker for this backend\"`\n\tFailureThreshold int           `json:\"failure_threshold\" yaml:\"failure_threshold\" toml:\"failure_threshold\" env:\"FAILURE_THRESHOLD\" default:\"5\" desc:\"Number of failures before opening circuit\"`\n\tRecoveryTimeout  time.Duration `json:\"recovery_timeout\" yaml:\"recovery_timeout\" toml:\"recovery_timeout\" env:\"RECOVERY_TIMEOUT\" default:\"60s\" desc:\"Time to wait before attempting recovery\"`\n}\n```\nBackendCircuitBreakerConfig provides per-backend circuit breaker configuration.\n\n```go\ntype BackendEndpointRequest struct {\n\tBackend     string\n\tMethod      string\n\tPath        string\n\tHeaders     map[string]string\n\tQueryParams map[string]string\n}\n```\nBackendEndpointRequest defines a request to be sent to a backend\n\n```go\ntype BackendHealthCheckConfig struct {\n\tEnabled             bool          `json:\"enabled\" yaml:\"enabled\" toml:\"enabled\" env:\"ENABLED\" default:\"true\" desc:\"Enable health checking for this backend\"`\n\tInterval            time.Duration `json:\"interval\" yaml:\"interval\" toml:\"interval\" env:\"INTERVAL\" desc:\"Health check interval\"`\n\tTimeout             time.Duration `json:\"timeout\" yaml:\"timeout\" toml:\"timeout\" env:\"TIMEOUT\" desc:\"Health check timeout\"`\n\tExpectedStatusCodes []int         `json:\"expected_status_codes\" yaml:\"expected_status_codes\" toml:\"expected_status_codes\" env:\"EXPECTED_STATUS_CODES\" desc:\"Expected status codes for health check\"`\n}\n```\nBackendHealthCheckConfig provides per-backend health check configuration.\n\n```go\ntype BackendHealthConfig struct {\n\tEnabled             bool          `json:\"enabled\" yaml:\"enabled\" toml:\"enabled\" env:\"ENABLED\" default:\"true\" desc:\"Enable health checking for this backend\"`\n\tEndpoint            string        `json:\"endpoint\" yaml:\"endpoint\" toml:\"endpoint\" env:\"ENDPOINT\" desc:\"Custom health check endpoint (defaults to base URL)\"`\n\tInterval            time.Duration `json:\"interval\" yaml:\"interval\" toml:\"interval\" env:\"INTERVAL\" desc:\"Override global interval for this backend\"`\n\tTimeout             time.Duration `json:\"timeout\" yaml:\"timeout\" toml:\"timeout\" env:\"TIMEOUT\" desc:\"Override global timeout for this backend\"`\n\tExpectedStatusCodes []int         `json:\"expected_status_codes\" yaml:\"expected_status_codes\" toml:\"expected_status_codes\" env:\"EXPECTED_STATUS_CODES\" desc:\"Override global expected status codes for this backend\"`\n}\n```\nBackendHealthConfig provides per-backend health check configuration.\n\n```go\ntype BackendServiceConfig struct {\n\t// URL is the base URL for the backend service\n\tURL string `json:\"url\" yaml:\"url\" toml:\"url\" env:\"URL\"`\n\n\t// PathRewriting defines path rewriting rules specific to this backend\n\tPathRewriting PathRewritingConfig `json:\"path_rewriting\" yaml:\"path_rewriting\" toml:\"path_rewriting\"`\n\n\t// Simple path rewrite for backwards compatibility\n\tPathRewrite string `json:\"path_rewrite\" yaml:\"path_rewrite\" toml:\"path_rewrite\" env:\"PATH_REWRITE\"`\n\n\t// HeaderRewriting defines header rewriting rules specific to this backend\n\tHeaderRewriting HeaderRewritingConfig `json:\"header_rewriting\" yaml:\"header_rewriting\" toml:\"header_rewriting\"`\n\n\t// ResponseHeaderRewriting defines response header rewriting rules specific to this backend\n\tResponseHeaderRewriting ResponseHeaderRewritingConfig `json:\"response_header_rewriting\" yaml:\"response_header_rewriting\" toml:\"response_header_rewriting\"`\n\n\t// Hostname handling mode for this backend\n\tHostnameHandling string `json:\"hostname_handling\" yaml:\"hostname_handling\" toml:\"hostname_handling\" env:\"HOSTNAME_HANDLING\"`\n\n\t// Custom hostname to use for this backend\n\tCustomHostname string `json:\"custom_hostname\" yaml:\"custom_hostname\" toml:\"custom_hostname\" env:\"CUSTOM_HOSTNAME\"`\n\n\t// Endpoints defines endpoint-specific configurations\n\tEndpoints map[string]EndpointConfig `json:\"endpoints\" yaml:\"endpoints\" toml:\"endpoints\"`\n\n\t// FeatureFlagID is the ID of the feature flag that controls whether this backend is enabled\n\t// If specified and the feature flag evaluates to false, requests to this backend will fail or use alternative\n\tFeatureFlagID string `json:\"feature_flag_id\" yaml:\"feature_flag_id\" toml:\"feature_flag_id\" env:\"FEATURE_FLAG_ID\"`\n\n\t// FeatureFlag is an alternative name for FeatureFlagID\n\tFeatureFlag string `json:\"feature_flag\" yaml:\"feature_flag\" toml:\"feature_flag\" env:\"FEATURE_FLAG\"`\n\n\t// AlternativeBackend specifies an alternative backend to use when the feature flag is disabled\n\t// If FeatureFlagID is specified and evaluates to false, requests will be routed to this backend instead\n\tAlternativeBackend string `json:\"alternative_backend\" yaml:\"alternative_backend\" toml:\"alternative_backend\" env:\"ALTERNATIVE_BACKEND\"`\n\n\t// AlternativeBackends is a list of alternative backends\n\tAlternativeBackends []string `json:\"alternative_backends\" yaml:\"alternative_backends\" toml:\"alternative_backends\" env:\"ALTERNATIVE_BACKENDS\"`\n\n\t// Health check configuration\n\tHealthCheck    BackendHealthCheckConfig `json:\"health_check\" yaml:\"health_check\" toml:\"health_check\"`\n\tHealthEndpoint string                   `json:\"health_endpoint\" yaml:\"health_endpoint\" toml:\"health_endpoint\" env:\"HEALTH_ENDPOINT\"`\n\n\t// Circuit breaker configuration\n\tCircuitBreaker BackendCircuitBreakerConfig `json:\"circuit_breaker\" yaml:\"circuit_breaker\" toml:\"circuit_breaker\"`\n\n\t// Retry configuration\n\tMaxRetries int           `json:\"max_retries\" yaml:\"max_retries\" toml:\"max_retries\" env:\"MAX_RETRIES\"`\n\tRetryDelay time.Duration `json:\"retry_delay\" yaml:\"retry_delay\" toml:\"retry_delay\" env:\"RETRY_DELAY\"`\n\n\t// Connection pool configuration\n\tMaxConnections    int           `json:\"max_connections\" yaml:\"max_connections\" toml:\"max_connections\" env:\"MAX_CONNECTIONS\"`\n\tConnectionTimeout time.Duration `json:\"connection_timeout\" yaml:\"connection_timeout\" toml:\"connection_timeout\" env:\"CONNECTION_TIMEOUT\"`\n\tIdleTimeout       time.Duration `json:\"idle_timeout\" yaml:\"idle_timeout\" toml:\"idle_timeout\" env:\"IDLE_TIMEOUT\"`\n\n\t// Queue configuration\n\tQueueSize    int           `json:\"queue_size\" yaml:\"queue_size\" toml:\"queue_size\" env:\"QUEUE_SIZE\"`\n\tQueueTimeout time.Duration `json:\"queue_timeout\" yaml:\"queue_timeout\" toml:\"queue_timeout\" env:\"QUEUE_TIMEOUT\"`\n}\n```\nBackendServiceConfig defines configuration for a specific backend service.\n\n```go\ntype CachedResponse struct {\n\tStatusCode     int\n\tHeaders        http.Header\n\tBody           []byte\n\tLastAccessed   time.Time\n\tExpirationTime time.Time\n}\n```\nCachedResponse represents a cached HTTP response\n\n```go\ntype CircuitBreaker struct {\n\t// contains filtered or unexported fields\n}\n```\nCircuitBreaker implements the circuit breaker pattern for HTTP requests.\n\n```go\nfunc NewCircuitBreaker(backendName string, metricsCollector *MetricsCollector) *CircuitBreaker\n```\nNewCircuitBreaker creates a new CircuitBreaker with default settings.\n\n```go\nfunc NewCircuitBreakerWithConfig(backendName string, config CircuitBreakerConfig, metricsCollector *MetricsCollector) *CircuitBreaker\n```\nNewCircuitBreakerWithConfig creates a new CircuitBreaker with custom settings.\n\n```go\nfunc (cb *CircuitBreaker) Execute(req *http.Request, fn func(*http.Request) (*http.Response, error)) (*http.Response, error)\n```\nExecute executes the provided function with circuit breaker protection.\n\n```go\nfunc (cb *CircuitBreaker) GetFailureCount() int\n```\nGetFailureCount returns the current failure count of the circuit breaker.\n\n```go\nfunc (cb *CircuitBreaker) GetState() CircuitState\n```\nGetState returns the current state of the circuit breaker.\n\n```go\nfunc (cb *CircuitBreaker) IsOpen() bool\n```\nIsOpen returns true if the circuit is open (no requests should be made).\n\n```go\nfunc (cb *CircuitBreaker) RecordFailure()\n```\nRecordFailure records a failed request and opens the circuit if threshold is reached.\n\n```go\nfunc (cb *CircuitBreaker) RecordSuccess()\n```\nRecordSuccess records a successful request and resets the failure count.\n\n```go\nfunc (cb *CircuitBreaker) Reset()\n```\nReset resets the circuit breaker to closed state (capitalized for backward compatibility).\n\n```go\nfunc (cb *CircuitBreaker) WithFailureThreshold(threshold int) *CircuitBreaker\n```\nWithFailureThreshold sets the number of failures required to open the circuit.\n\n```go\nfunc (cb *CircuitBreaker) WithMetricsCollector(collector *MetricsCollector) *CircuitBreaker\n```\nWithMetricsCollector associates a metrics collector with this circuit breaker.\n\n```go\nfunc (cb *CircuitBreaker) WithRequestTimeout(timeout time.Duration) *CircuitBreaker\n```\nWithRequestTimeout sets the timeout for each request protected by this circuit breaker.\n\n```go\nfunc (cb *CircuitBreaker) WithResetTimeout(timeout time.Duration) *CircuitBreaker\n```\nWithResetTimeout sets the duration to wait before allowing a test request.\n\n```go\ntype CircuitBreakerConfig struct {\n\tEnabled                 bool          `json:\"enabled\" yaml:\"enabled\" toml:\"enabled\" env:\"ENABLED\"`\n\tFailureThreshold        int           `json:\"failure_threshold\" yaml:\"failure_threshold\" toml:\"failure_threshold\" env:\"FAILURE_THRESHOLD\"`\n\tSuccessThreshold        int           `json:\"success_threshold\" yaml:\"success_threshold\" toml:\"success_threshold\" env:\"SUCCESS_THRESHOLD\"`\n\tOpenTimeout             time.Duration `json:\"open_timeout\" yaml:\"open_timeout\" toml:\"open_timeout\" env:\"OPEN_TIMEOUT\"`\n\tRequestTimeout          time.Duration `json:\"request_timeout\" yaml:\"request_timeout\" toml:\"request_timeout\" env:\"REQUEST_TIMEOUT\"`\n\tHalfOpenAllowedRequests int           `json:\"half_open_allowed_requests\" yaml:\"half_open_allowed_requests\" toml:\"half_open_allowed_requests\" env:\"HALF_OPEN_ALLOWED_REQUESTS\"`\n\tWindowSize              int           `json:\"window_size\" yaml:\"window_size\" toml:\"window_size\" env:\"WINDOW_SIZE\"`\n\tSuccessRateThreshold    float64       `json:\"success_rate_threshold\" yaml:\"success_rate_threshold\" toml:\"success_rate_threshold\" env:\"SUCCESS_RATE_THRESHOLD\"`\n}\n```\nCircuitBreakerConfig provides configuration for the circuit breaker.\n\n```go\ntype CircuitBreakerInfo struct {\n\tState            string    `json:\"state\"`\n\tFailureCount     int       `json:\"failureCount\"`\n\tFailures         int       `json:\"failures\"` // alias field expected by tests\n\tSuccessCount     int       `json:\"successCount\"`\n\tLastFailure      time.Time `json:\"lastFailure,omitempty\"`\n\tLastAttempt      time.Time `json:\"lastAttempt,omitempty\"`\n\tFailureThreshold int       `json:\"failureThreshold,omitempty\"`\n\tResetTimeout     string    `json:\"resetTimeout,omitempty\"`\n}\n```\nCircuitBreakerInfo represents circuit breaker status information.\n\n```go\ntype CircuitBreakerProvider func(backendID string) *HealthCircuitBreakerInfo\n```\nCircuitBreakerProvider defines a function to get circuit breaker information for a backend.\n\n```go\ntype CircuitState int\n```\nCircuitState represents the state of a circuit breaker.\n\n```go\nconst (\n\t// StateClosed indicates the circuit is closed and allowing requests.\n\tStateClosed CircuitState = iota\n\t// StateOpen indicates the circuit is open and blocking requests.\n\tStateOpen\n\t// StateHalfOpen indicates the circuit is allowing a test request.\n\tStateHalfOpen\n\n\t// DefaultRequestTimeout is the default timeout for requests when not configured.\n\tDefaultRequestTimeout = 30 * time.Second\n)\n```\n\n```go\nfunc (s CircuitState) String() string\n```\nString returns a string representation of the circuit state.\n\n```go\ntype ComparisonResult struct {\n\tStatusCodeMatch bool                  `json:\"statusCodeMatch\"`\n\tHeadersMatch    bool                  `json:\"headersMatch\"`\n\tBodyMatch       bool                  `json:\"bodyMatch\"`\n\tDifferences     []string              `json:\"differences,omitempty\"`\n\tHeaderDiffs     map[string]HeaderDiff `json:\"headerDiffs,omitempty\"`\n}\n```\nComparisonResult contains the results of comparing two responses.\n\n```go\ntype CompositeHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nCompositeHandler is updated to handle multiple requests and process/merge them into a single response. It now includes circuit breaking and response caching.\n\n```go\nfunc NewCompositeHandler(backends []*Backend, strategy CompositeStrategy, responseTimeout time.Duration) *CompositeHandler\n```\nNewCompositeHandler creates a new composite handler with the given backends and strategy.\n\n```go\nfunc (h *CompositeHandler) ConfigureCircuitBreakers(globalConfig CircuitBreakerConfig, backendConfigs map[string]CircuitBreakerConfig)\n```\nConfigureCircuitBreakers sets up circuit breakers for each backend using the provided configuration\n\n```go\nfunc (h *CompositeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\nServeHTTP handles the request by forwarding it to all backends and merging the responses.\n\n```go\nfunc (h *CompositeHandler) SetEventEmitter(emitter func(eventType string, data map[string]interface{}))\n```\nSetEventEmitter sets the event emitter function for the composite handler.\n\n```go\nfunc (h *CompositeHandler) SetResponseCache(cache *responseCache)\n```\nSetResponseCache sets a response cache for the handler.\n\n```go\nfunc (h *CompositeHandler) SetResponseTransformer(transformer ResponseTransformer)\n```\nSetResponseTransformer sets a custom response transformer function.\n\n```go\ntype CompositeResponse struct {\n\tStatusCode int\n\tHeaders    http.Header\n\tBody       []byte\n}\n```\nCompositeResponse represents a transformed response from multiple backend requests\n\n```go\ntype CompositeRoute struct {\n\tPattern  string   `json:\"pattern\" yaml:\"pattern\" toml:\"pattern\" env:\"PATTERN\"`\n\tBackends []string `json:\"backends\" yaml:\"backends\" toml:\"backends\" env:\"BACKENDS\"`\n\tStrategy string   `json:\"strategy\" yaml:\"strategy\" toml:\"strategy\" env:\"STRATEGY\"`\n\n\t// FeatureFlagID is the ID of the feature flag that controls whether this composite route is enabled\n\t// If specified and the feature flag evaluates to false, this route will return 404\n\tFeatureFlagID string `json:\"feature_flag_id\" yaml:\"feature_flag_id\" toml:\"feature_flag_id\" env:\"FEATURE_FLAG_ID\"`\n\n\t// AlternativeBackend specifies an alternative single backend to use when the feature flag is disabled\n\t// If FeatureFlagID is specified and evaluates to false, requests will be routed to this backend instead\n\tAlternativeBackend string `json:\"alternative_backend\" yaml:\"alternative_backend\" toml:\"alternative_backend\" env:\"ALTERNATIVE_BACKEND\"`\n}\n```\nCompositeRoute defines a route that combines responses from multiple backends.\n\n```go\ntype CompositeStrategy string\n```\nCompositeStrategy defines how responses from multiple backends are combined.\n\n```go\nconst (\n\t// StrategyFirstSuccess returns the first successful response from backends (in order).\n\t// Backends are tried sequentially until one succeeds.\n\tStrategyFirstSuccess CompositeStrategy = \"first-success\"\n\n\t// StrategyMerge attempts to merge JSON responses from all backends into a single JSON object.\n\t// Requests are executed in parallel and responses are combined.\n\tStrategyMerge CompositeStrategy = \"merge\"\n\n\t// StrategySequential executes requests sequentially and returns the last successful response.\n\t// This is useful when later backends depend on earlier ones completing.\n\tStrategySequential CompositeStrategy = \"sequential\"\n)\n```\n\n```go\ntype DebugConfig struct {\n\tEnabled                 bool   `json:\"enabled\" yaml:\"enabled\" toml:\"enabled\" env:\"ENABLED\" default:\"false\" desc:\"Enable debug endpoints\"`\n\tInfoEndpoint            string `json:\"info_endpoint\" yaml:\"info_endpoint\" toml:\"info_endpoint\" env:\"INFO_ENDPOINT\" default:\"/debug/info\" desc:\"Debug info endpoint path\"`\n\tBackendsEndpoint        string `json:\"backends_endpoint\" yaml:\"backends_endpoint\" toml:\"backends_endpoint\" env:\"BACKENDS_ENDPOINT\" default:\"/debug/backends\" desc:\"Debug backends endpoint path\"`\n\tFlagsEndpoint           string `json:\"flags_endpoint\" yaml:\"flags_endpoint\" toml:\"flags_endpoint\" env:\"FLAGS_ENDPOINT\" default:\"/debug/flags\" desc:\"Debug feature flags endpoint path\"`\n\tCircuitBreakersEndpoint string `json:\"circuit_breakers_endpoint\" yaml:\"circuit_breakers_endpoint\" toml:\"circuit_breakers_endpoint\" env:\"CIRCUIT_BREAKERS_ENDPOINT\" default:\"/debug/circuit-breakers\" desc:\"Debug circuit breakers endpoint path\"`\n\tHealthChecksEndpoint    string `json:\"health_checks_endpoint\" yaml:\"health_checks_endpoint\" toml:\"health_checks_endpoint\" env:\"HEALTH_CHECKS_ENDPOINT\" default:\"/debug/health-checks\" desc:\"Debug health checks endpoint path\"`\n}\n```\nDebugConfig provides configuration for debug endpoints.\n\n```go\ntype DebugEndpointsConfig struct {\n\t// Enabled determines if debug endpoints should be available\n\tEnabled bool `json:\"enabled\" yaml:\"enabled\" toml:\"enabled\" env:\"DEBUG_ENDPOINTS_ENABLED\" default:\"false\"`\n\n\t// BasePath is the base path for debug endpoints\n\tBasePath string `json:\"base_path\" yaml:\"base_path\" toml:\"base_path\" env:\"DEBUG_BASE_PATH\" default:\"/debug\"`\n\n\t// RequireAuth determines if debug endpoints require authentication\n\tRequireAuth bool `json:\"require_auth\" yaml:\"require_auth\" toml:\"require_auth\" env:\"DEBUG_REQUIRE_AUTH\" default:\"false\"`\n\n\t// AuthToken is the token required for debug endpoint access (if RequireAuth is true)\n\tAuthToken string `json:\"auth_token\" yaml:\"auth_token\" toml:\"auth_token\" env:\"DEBUG_AUTH_TOKEN\"` //nolint:gosec // G117: auth_token is a debug endpoint configuration field, not a credential\n}\n```\nDebugEndpointsConfig provides configuration for debug endpoints.\n\n```go\ntype DebugHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nDebugHandler handles debug endpoint requests.\n\n```go\nfunc NewDebugHandler(config DebugEndpointsConfig, featureFlagEval FeatureFlagEvaluator, proxyConfig *ReverseProxyConfig, tenantService modular.TenantService, logger modular.Logger) *DebugHandler\n```\nNewDebugHandler creates a new debug handler.\n\n```go\nfunc (d *DebugHandler) HandleBackends(w http.ResponseWriter, r *http.Request)\n```\nHandleBackends handles the backends debug endpoint.\n\n```go\nfunc (d *DebugHandler) HandleCircuitBreakers(w http.ResponseWriter, r *http.Request)\n```\nHandleCircuitBreakers handles the circuit breakers debug endpoint.\n\n```go\nfunc (d *DebugHandler) HandleFlags(w http.ResponseWriter, r *http.Request)\n```\nHandleFlags handles the feature flags debug endpoint.\n\n```go\nfunc (d *DebugHandler) HandleHealthChecks(w http.ResponseWriter, r *http.Request)\n```\nHandleHealthChecks handles the health checks debug endpoint.\n\n```go\nfunc (d *DebugHandler) HandleInfo(w http.ResponseWriter, r *http.Request)\n```\nHandleInfo handles the general debug info endpoint.\n\n```go\nfunc (d *DebugHandler) RegisterRoutes(mux *http.ServeMux)\n```\nRegisterRoutes registers debug endpoint routes with the provided mux.\n\n```go\nfunc (d *DebugHandler) SetCircuitBreakers(circuitBreakers map[string]*CircuitBreaker)\n```\nSetCircuitBreakers updates the circuit breakers reference for debugging.\n\n```go\nfunc (d *DebugHandler) SetHealthCheckers(healthCheckers map[string]*HealthChecker)\n```\nSetHealthCheckers updates the health checkers reference for debugging.\n\n```go\ntype DebugInfo struct {\n\tTimestamp       time.Time                     `json:\"timestamp\"`\n\tModuleName      string                        `json:\"module_name\"`\n\tTenant          string                        `json:\"tenant,omitempty\"`\n\tEnvironment     string                        `json:\"environment\"`\n\tFlags           map[string]interface{}        `json:\"flags,omitempty\"`\n\tBackendServices map[string]string             `json:\"backendServices\"`\n\tRoutes          map[string]string             `json:\"routes\"`\n\tCircuitBreakers map[string]CircuitBreakerInfo `json:\"circuitBreakers,omitempty\"`\n\tHealthChecks    map[string]HealthInfo         `json:\"healthChecks,omitempty\"`\n}\n```\nDebugInfo represents debugging information about the reverse proxy state.\n\n```go\ntype DryRunConfig struct {\n\t// Enabled determines if dry-run mode is available\n\tEnabled bool `json:\"enabled\" yaml:\"enabled\" toml:\"enabled\" env:\"DRY_RUN_ENABLED\" default:\"false\"`\n\n\t// LogResponses determines if response bodies should be logged (can be verbose)\n\tLogResponses bool `json:\"log_responses\" yaml:\"log_responses\" toml:\"log_responses\" env:\"DRY_RUN_LOG_RESPONSES\" default:\"false\"`\n\n\t// MaxResponseSize is the maximum response size to compare (in bytes)\n\tMaxResponseSize int64 `json:\"max_response_size\" yaml:\"max_response_size\" toml:\"max_response_size\" env:\"DRY_RUN_MAX_RESPONSE_SIZE\" default:\"1048576\"` // 1MB\n\n\t// CompareHeaders determines which headers should be compared\n\tCompareHeaders []string `json:\"compare_headers\" yaml:\"compare_headers\" toml:\"compare_headers\" env:\"DRY_RUN_COMPARE_HEADERS\"`\n\n\t// IgnoreHeaders lists headers to ignore during comparison\n\tIgnoreHeaders []string `json:\"ignore_headers\" yaml:\"ignore_headers\" toml:\"ignore_headers\" env:\"DRY_RUN_IGNORE_HEADERS\"`\n\n\t// DefaultResponseBackend specifies which backend response to return by default (\"primary\" or \"secondary\")\n\tDefaultResponseBackend string `json:\"default_response_backend\" yaml:\"default_response_backend\" toml:\"default_response_backend\" env:\"DRY_RUN_DEFAULT_RESPONSE_BACKEND\" default:\"primary\"`\n}\n```\nDryRunConfig provides configuration for dry-run functionality.\n\n```go\ntype DryRunHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nDryRunHandler handles dry-run request processing.\n\n```go\nfunc NewDryRunHandler(config DryRunConfig, tenantIDHeader string, logger modular.Logger) *DryRunHandler\n```\nNewDryRunHandler creates a new dry-run handler.\n\n```go\nfunc (d *DryRunHandler) ProcessDryRun(ctx context.Context, req *http.Request, primaryBackend, secondaryBackend string) (*DryRunResult, error)\n```\nProcessDryRun processes a request in dry-run mode, sending it to both backends and comparing responses.\n\n```go\ntype DryRunResult struct {\n\tTimestamp         time.Time        `json:\"timestamp\"`\n\tRequestID         string           `json:\"requestId,omitempty\"`\n\tTenantID          string           `json:\"tenantId,omitempty\"`\n\tEndpoint          string           `json:\"endpoint\"`\n\tMethod            string           `json:\"method\"`\n\tPrimaryBackend    string           `json:\"primaryBackend\"`\n\tSecondaryBackend  string           `json:\"secondaryBackend\"`\n\tPrimaryResponse   ResponseInfo     `json:\"primaryResponse\"`\n\tSecondaryResponse ResponseInfo     `json:\"secondaryResponse\"`\n\tComparison        ComparisonResult `json:\"comparison\"`\n\tDuration          DurationInfo     `json:\"duration\"`\n\tReturnedResponse  string           `json:\"returnedResponse\"` // \"primary\" or \"secondary\" - indicates which response was returned to client\n}\n```\nDryRunResult represents the result of a dry-run comparison.\n\n```go\nfunc (d *DryRunResult) GetReturnedResponse() ResponseInfo\n```\nGetReturnedResponse returns the response information that should be sent to the client.\n\n```go\ntype DurationInfo struct {\n\tTotal     time.Duration `json:\"total\"`\n\tPrimary   time.Duration `json:\"primary\"`\n\tSecondary time.Duration `json:\"secondary\"`\n}\n```\nDurationInfo contains timing information for the dry-run.\n\n```go\ntype EndpointConfig struct {\n\t// Pattern is the URL pattern that this endpoint matches (e.g., \"/api/v1/users/*\")\n\tPattern string `json:\"pattern\" yaml:\"pattern\" toml:\"pattern\" env:\"PATTERN\"`\n\n\t// PathRewriting defines path rewriting rules specific to this endpoint\n\tPathRewriting PathRewritingConfig `json:\"path_rewriting\" yaml:\"path_rewriting\" toml:\"path_rewriting\"`\n\n\t// HeaderRewriting defines header rewriting rules specific to this endpoint\n\tHeaderRewriting HeaderRewritingConfig `json:\"header_rewriting\" yaml:\"header_rewriting\" toml:\"header_rewriting\"`\n\n\t// ResponseHeaderRewriting defines response header rewriting rules specific to this endpoint\n\tResponseHeaderRewriting ResponseHeaderRewritingConfig `json:\"response_header_rewriting\" yaml:\"response_header_rewriting\" toml:\"response_header_rewriting\"`\n\n\t// FeatureFlagID is the ID of the feature flag that controls whether this endpoint is enabled\n\t// If specified and the feature flag evaluates to false, this endpoint will be skipped\n\tFeatureFlagID string `json:\"feature_flag_id\" yaml:\"feature_flag_id\" toml:\"feature_flag_id\" env:\"FEATURE_FLAG_ID\"`\n\n\t// AlternativeBackend specifies an alternative backend to use when the feature flag is disabled\n\t// If FeatureFlagID is specified and evaluates to false, requests will be routed to this backend instead\n\tAlternativeBackend string `json:\"alternative_backend\" yaml:\"alternative_backend\" toml:\"alternative_backend\" env:\"ALTERNATIVE_BACKEND\"`\n}\n```\nEndpointConfig defines configuration for a specific endpoint within a backend service.\n\n```go\ntype EndpointMapping struct {\n\t// Endpoints lists the backend requests to make\n\tEndpoints []BackendEndpointRequest\n\n\t// ResponseTransformer is a function that transforms multiple backend responses\n\t// into a single composite response\n\tResponseTransformer func(ctx context.Context, req *http.Request, responses map[string]*http.Response) (*CompositeResponse, error)\n}\n```\nEndpointMapping defines how requests should be routed to different backends and how their responses should be combined\n\n```go\ntype EndpointRewriteRule struct {\n\t// Pattern is the incoming request pattern to match (e.g., \"/api/v1/users\")\n\tPattern string `json:\"pattern\" yaml:\"pattern\" toml:\"pattern\" env:\"PATTERN\"`\n\n\t// Replacement is the new path to use when forwarding to backend (e.g., \"/users\")\n\tReplacement string `json:\"replacement\" yaml:\"replacement\" toml:\"replacement\" env:\"REPLACEMENT\"`\n\n\t// Backend specifies which backend this rule applies to (optional, applies to all if empty)\n\tBackend string `json:\"backend\" yaml:\"backend\" toml:\"backend\" env:\"BACKEND\"`\n\n\t// StripQueryParams removes query parameters from the request when forwarding\n\tStripQueryParams bool `json:\"strip_query_params\" yaml:\"strip_query_params\" toml:\"strip_query_params\" env:\"STRIP_QUERY_PARAMS\"`\n}\n```\nEndpointRewriteRule defines a rewrite rule for a specific endpoint pattern.\n\n```go\ntype ErrorHandlingConfig struct {\n\tEnableCustomPages bool          `json:\"enable_custom_pages\" yaml:\"enable_custom_pages\" toml:\"enable_custom_pages\" env:\"ENABLE_CUSTOM_PAGES\" default:\"false\" desc:\"Enable custom error pages\"`\n\tRetryAttempts     int           `json:\"retry_attempts\" yaml:\"retry_attempts\" toml:\"retry_attempts\" env:\"RETRY_ATTEMPTS\" default:\"0\" desc:\"Number of retry attempts for failed requests\"`\n\tConnectionRetries int           `json:\"connection_retries\" yaml:\"connection_retries\" toml:\"connection_retries\" env:\"CONNECTION_RETRIES\" default:\"0\" desc:\"Number of connection retry attempts\"`\n\tRetryDelay        time.Duration `json:\"retry_delay\" yaml:\"retry_delay\" toml:\"retry_delay\" env:\"RETRY_DELAY\" default:\"1s\" desc:\"Delay between retry attempts\"`\n}\n```\nErrorHandlingConfig provides configuration for error handling.\n\n```go\ntype FeatureFlagAggregator struct {\n\t// contains filtered or unexported fields\n}\n```\nFeatureFlagAggregator implements FeatureFlagEvaluator by aggregating multiple evaluators and calling them in priority order (weight-based). It discovers evaluators from the service registry by name prefix pattern.\n\n```go\nfunc NewFeatureFlagAggregator(app modular.Application, logger *slog.Logger) *FeatureFlagAggregator\n```\nNewFeatureFlagAggregator creates a new aggregator that discovers and coordinates multiple feature flag evaluators from the application's service registry.\n\n```go\nfunc (a *FeatureFlagAggregator) EvaluateFlag(ctx context.Context, flagID string, tenantID modular.TenantID, req *http.Request) (bool, error)\n```\nEvaluateFlag implements FeatureFlagEvaluator by calling discovered evaluators in weight order until one returns a decision or all have been tried.\n\n```go\nfunc (a *FeatureFlagAggregator) EvaluateFlagWithDefault(ctx context.Context, flagID string, tenantID modular.TenantID, req *http.Request, defaultValue bool) bool\n```\nEvaluateFlagWithDefault implements FeatureFlagEvaluator by calling EvaluateFlag and returning the default value if evaluation fails.\n\n```go\ntype FeatureFlagEvaluator interface {\n\t// EvaluateFlag evaluates a feature flag for the given context and request.\n\t// Returns true if the feature flag is enabled, false otherwise.\n\t// The tenantID parameter can be empty if no tenant context is available.\n\t//\n\t// Special error handling:\n\t// - Returning ErrNoDecision allows evaluation to continue to next evaluator\n\t// - Returning ErrEvaluatorFatal stops evaluation chain immediately\n\t// - Other errors are treated as non-fatal and evaluation continues\n\tEvaluateFlag(ctx context.Context, flagID string, tenantID modular.TenantID, req *http.Request) (bool, error)\n\n\t// EvaluateFlagWithDefault evaluates a feature flag with a default value.\n\t// If evaluation fails or the flag doesn't exist, returns the default value.\n\tEvaluateFlagWithDefault(ctx context.Context, flagID string, tenantID modular.TenantID, req *http.Request, defaultValue bool) bool\n}\n```\nFeatureFlagEvaluator defines the interface for evaluating feature flags. This allows for different implementations of feature flag services while providing a consistent interface for the reverseproxy module.\n\nEvaluators may return special sentinel errors to control aggregation behavior:\n\n  - ErrNoDecision: Evaluator abstains and evaluation continues to next evaluator\n  - ErrEvaluatorFatal: Fatal error that stops evaluation chain immediately\n\n```go\ntype FeatureFlagsConfig struct {\n\t// Enabled determines whether to create and expose the built-in FileBasedFeatureFlagEvaluator service\n\tEnabled bool `json:\"enabled\" yaml:\"enabled\" toml:\"enabled\" env:\"ENABLED\" default:\"false\" desc:\"Enable the built-in file-based feature flag evaluator service\"`\n\n\t// Flags defines default values for feature flags. Tenant-specific overrides come from tenant config files.\n\tFlags map[string]bool `json:\"flags\" yaml:\"flags\" toml:\"flags\" desc:\"Default values for feature flags\"`\n}\n```\nFeatureFlagsConfig provides configuration for the built-in feature flag evaluator.\n\n```go\ntype FileBasedFeatureFlagEvaluator struct {\n\t// contains filtered or unexported fields\n}\n```\nFileBasedFeatureFlagEvaluator implements a feature flag evaluator that integrates with the Modular framework's tenant-aware configuration system.\n\n```go\nfunc NewFileBasedFeatureFlagEvaluator(ctx context.Context, app modular.Application, logger *slog.Logger) (*FileBasedFeatureFlagEvaluator, error)\n```\nNewFileBasedFeatureFlagEvaluator creates a new tenant-aware feature flag evaluator.\n\n```go\nfunc (f *FileBasedFeatureFlagEvaluator) EvaluateFlag(ctx context.Context, flagID string, tenantID modular.TenantID, req *http.Request) (bool, error)\n```\nEvaluateFlag evaluates a feature flag using tenant-aware configuration. It follows the standard Modular framework pattern where: 1. Default flags come from the main configuration 2. Tenant-specific overrides come from tenant configuration files 3. During request processing, tenant context determines which configuration to use\n\n```go\nfunc (f *FileBasedFeatureFlagEvaluator) EvaluateFlagWithDefault(ctx context.Context, flagID string, tenantID modular.TenantID, req *http.Request, defaultValue bool) bool\n```\nEvaluateFlagWithDefault evaluates a feature flag with a default value.\n\n```go\ntype HeaderConfig struct {\n\tSetHeaders    map[string]string `json:\"set_headers\" yaml:\"set_headers\" toml:\"set_headers\" desc:\"Headers to set on requests\"`\n\tRemoveHeaders []string          `json:\"remove_headers\" yaml:\"remove_headers\" toml:\"remove_headers\" desc:\"Headers to remove from requests\"`\n}\n```\nHeaderConfig provides configuration for header management.\n\n```go\ntype HeaderDiff struct {\n\tPrimary   string `json:\"primary\"`\n\tSecondary string `json:\"secondary\"`\n}\n```\nHeaderDiff represents a difference in header values.\n\n```go\ntype HeaderRewritingConfig struct {\n\t// HostnameHandling controls how the Host header is handled\n\tHostnameHandling HostnameHandlingMode `json:\"hostname_handling\" yaml:\"hostname_handling\" toml:\"hostname_handling\" env:\"HOSTNAME_HANDLING\"`\n\n\t// CustomHostname sets a custom hostname to use instead of the original or backend hostname\n\tCustomHostname string `json:\"custom_hostname\" yaml:\"custom_hostname\" toml:\"custom_hostname\" env:\"CUSTOM_HOSTNAME\"`\n\n\t// SetHeaders defines headers to set or override on the request\n\tSetHeaders map[string]string `json:\"set_headers\" yaml:\"set_headers\" toml:\"set_headers\"`\n\n\t// RemoveHeaders defines headers to remove from the request\n\tRemoveHeaders []string `json:\"remove_headers\" yaml:\"remove_headers\" toml:\"remove_headers\"`\n}\n```\nHeaderRewritingConfig defines configuration for header rewriting rules.\n\n```go\ntype HealthCheckConfig struct {\n\tEnabled                  bool                           `json:\"enabled\" yaml:\"enabled\" toml:\"enabled\" env:\"ENABLED\" default:\"false\" desc:\"Enable health checking for backend services\"`\n\tInterval                 time.Duration                  `json:\"interval\" yaml:\"interval\" toml:\"interval\" env:\"INTERVAL\" default:\"30s\" desc:\"Interval between health checks\"`\n\tTimeout                  time.Duration                  `json:\"timeout\" yaml:\"timeout\" toml:\"timeout\" env:\"TIMEOUT\" default:\"5s\" desc:\"Timeout for health check requests\"`\n\tRecentRequestThreshold   time.Duration                  `json:\"recent_request_threshold\" yaml:\"recent_request_threshold\" toml:\"recent_request_threshold\" env:\"RECENT_REQUEST_THRESHOLD\" default:\"60s\" desc:\"Skip health check if a request to the backend occurred within this time\"`\n\tHealthEndpoints          map[string]string              `json:\"health_endpoints\" yaml:\"health_endpoints\" toml:\"health_endpoints\" env:\"HEALTH_ENDPOINTS\" desc:\"Custom health check endpoints for specific backends (defaults to base URL)\"`\n\tExpectedStatusCodes      []int                          `json:\"expected_status_codes\" yaml:\"expected_status_codes\" toml:\"expected_status_codes\" env:\"EXPECTED_STATUS_CODES\" default:\"[200]\" desc:\"HTTP status codes considered healthy\"`\n\tBackendHealthCheckConfig map[string]BackendHealthConfig `json:\"backend_health_check_config\" yaml:\"backend_health_check_config\" toml:\"backend_health_check_config\" desc:\"Per-backend health check configuration\"`\n}\n```\nHealthCheckConfig provides configuration for backend health checking.\n\n```go\ntype HealthChecker struct {\n\t// contains filtered or unexported fields\n}\n```\nHealthChecker manages health checking for backend services.\n\n```go\nfunc NewHealthChecker(config *HealthCheckConfig, backends map[string]string, httpClient *http.Client, logger *slog.Logger) *HealthChecker\n```\nNewHealthChecker creates a new health checker with the given configuration.\n\n```go\nfunc (hc *HealthChecker) GetBackendHealthStatus(backendID string) (*HealthStatus, bool)\n```\nGetBackendHealthStatus returns the health status for a specific backend.\n\n```go\nfunc (hc *HealthChecker) GetHealthStatus() map[string]*HealthStatus\n```\nGetHealthStatus returns the current health status for all backends.\n\n```go\nfunc (hc *HealthChecker) GetOverallHealthStatus(includeDetails bool) *OverallHealthStatus\n```\nGetOverallHealthStatus returns the overall health status of all backends. The service is considered healthy if all configured backends are healthy.\n\n```go\nfunc (hc *HealthChecker) IsRunning() bool\n```\nIsRunning returns whether the health checker is currently running.\n\n```go\nfunc (hc *HealthChecker) RecordBackendRequest(backendID string)\n```\nRecordBackendRequest records that a request was made to a backend.\n\n```go\nfunc (hc *HealthChecker) SetCircuitBreakerProvider(provider CircuitBreakerProvider)\n```\nSetCircuitBreakerProvider sets the circuit breaker provider function.\n\n```go\nfunc (hc *HealthChecker) SetEventEmitter(emitter HealthEventEmitter)\n```\nSetEventEmitter sets the callback used to emit health events.\n\n```go\nfunc (hc *HealthChecker) Start(ctx context.Context) error\n```\nStart begins the health checking process.\n\n```go\nfunc (hc *HealthChecker) Stop(ctx context.Context)\n```\nStop stops the health checking process and waits for all goroutines to terminate.\n\n```go\nfunc (hc *HealthChecker) UpdateBackends(ctx context.Context, backends map[string]string)\n```\nUpdateBackends updates the list of backends to monitor.\n\n```go\nfunc (hc *HealthChecker) UpdateHealthConfig(ctx context.Context, cfg *HealthCheckConfig)\n```\nUpdateHealthConfig replaces internal copies of health-related configuration maps atomically.\n\n```go\ntype HealthCircuitBreakerInfo struct {\n\tIsOpen       bool\n\tState        string\n\tFailureCount int\n}\n```\nHealthCircuitBreakerInfo provides circuit breaker status information for health checks.\n\n```go\ntype HealthEventEmitter func(eventType string, data map[string]interface{})\n```\nHealthEventEmitter is a callback used to emit backend health events. Accepts event type and a data map for the event payload.\n\n```go\ntype HealthInfo struct {\n\tStatus              string    `json:\"status\"`\n\tLastCheck           time.Time `json:\"lastCheck,omitempty\"`\n\tLastSuccess         time.Time `json:\"lastSuccess,omitempty\"`\n\tLastError           string    `json:\"lastError,omitempty\"`\n\tResponseTime        string    `json:\"responseTime,omitempty\"`\n\tStatusCode          int       `json:\"statusCode,omitempty\"`\n\tDNSResolved         bool      `json:\"dnsResolved\"`\n\tResolvedIPs         []string  `json:\"resolvedIPs,omitempty\"`\n\tTotalChecks         int64     `json:\"totalChecks\"`\n\tSuccessfulChecks    int64     `json:\"successfulChecks\"`\n\tChecksSkipped       int64     `json:\"checksSkipped\"`\n\tHealthCheckPassing  bool      `json:\"healthCheckPassing\"`\n\tCircuitBreakerOpen  bool      `json:\"circuitBreakerOpen\"`\n\tCircuitBreakerState string    `json:\"circuitBreakerState,omitempty\"`\n\tCircuitFailureCount int       `json:\"circuitFailureCount,omitempty\"`\n}\n```\nHealthInfo represents backend health information.\n\n```go\ntype HealthStatus struct {\n\tBackendID        string        `json:\"backend_id\"`\n\tURL              string        `json:\"url\"`\n\tHealthy          bool          `json:\"healthy\"`\n\tLastCheck        time.Time     `json:\"last_check\"`\n\tLastSuccess      time.Time     `json:\"last_success\"`\n\tLastError        string        `json:\"last_error,omitempty\"`\n\tResponseTime     time.Duration `json:\"response_time\"`\n\tDNSResolved      bool          `json:\"dns_resolved\"`\n\tResolvedIPs      []string      `json:\"resolved_ips,omitempty\"`\n\tLastRequest      time.Time     `json:\"last_request\"`\n\tChecksSkipped    int64         `json:\"checks_skipped\"`\n\tTotalChecks      int64         `json:\"total_checks\"`\n\tSuccessfulChecks int64         `json:\"successful_checks\"`\n\t// Circuit breaker status\n\tCircuitBreakerOpen  bool   `json:\"circuit_breaker_open\"`\n\tCircuitBreakerState string `json:\"circuit_breaker_state,omitempty\"`\n\tCircuitFailureCount int    `json:\"circuit_failure_count,omitempty\"`\n\t// Health check result (independent of circuit breaker status)\n\tHealthCheckPassing bool `json:\"health_check_passing\"`\n}\n```\nHealthStatus represents the health status of a backend service.\n\n```go\ntype HostnameHandlingMode string\n```\nHostnameHandlingMode defines how the Host header should be handled when forwarding requests.\n\n```go\nconst (\n\t// HostnamePreserveOriginal preserves the original client's Host header (default)\n\tHostnamePreserveOriginal HostnameHandlingMode = \"preserve_original\"\n\n\t// HostnameUseBackend uses the backend service's hostname\n\tHostnameUseBackend HostnameHandlingMode = \"use_backend\"\n\n\t// HostnameUseCustom uses a custom hostname specified in CustomHostname\n\tHostnameUseCustom HostnameHandlingMode = \"use_custom\"\n)\n```\n\n```go\ntype MetricsCollector struct {\n\t// contains filtered or unexported fields\n}\n```\nMetricsCollector collects and provides metrics for the reverse proxy.\n\n```go\nfunc NewMetricsCollector() *MetricsCollector\n```\nNewMetricsCollector creates a new MetricsCollector.\n\n```go\nfunc (m *MetricsCollector) GetMetrics() map[string]interface{}\n```\nGetMetrics returns the collected metrics.\n\n```go\nfunc (m *MetricsCollector) MetricsHandler() http.HandlerFunc\n```\nMetricsHandler returns an HTTP handler for metrics endpoint.\n\n```go\nfunc (m *MetricsCollector) RecordRequest(backend string, start time.Time, statusCode int, err error, metadata ...map[string]string)\n```\nRecordRequest records a request to a backend.\n\n```go\nfunc (m *MetricsCollector) SetCircuitBreakerStateString(backend string, state string)\n```\nSetCircuitBreakerStateString sets the status of a circuit breaker with an explicit state string.\n\n```go\nfunc (m *MetricsCollector) SetCircuitBreakerStatus(backend string, isOpen bool)\n```\nSetCircuitBreakerStatus sets the status of a circuit breaker.\n\n```go\ntype MetricsConfig struct {\n\tEnabled  bool   `json:\"enabled\" yaml:\"enabled\" toml:\"enabled\" env:\"ENABLED\" default:\"false\" desc:\"Enable metrics collection\"`\n\tEndpoint string `json:\"endpoint\" yaml:\"endpoint\" toml:\"endpoint\" env:\"ENDPOINT\" default:\"/metrics\" desc:\"Metrics endpoint path\"`\n}\n```\nMetricsConfig provides configuration for metrics collection.\n\n```go\ntype OverallHealthStatus struct {\n\tHealthy           bool                     `json:\"healthy\"`\n\tTotalBackends     int                      `json:\"total_backends\"`\n\tHealthyBackends   int                      `json:\"healthy_backends\"`\n\tUnhealthyBackends int                      `json:\"unhealthy_backends\"`\n\tCircuitOpenCount  int                      `json:\"circuit_open_count\"`\n\tLastCheck         time.Time                `json:\"last_check\"`\n\tBackendDetails    map[string]*HealthStatus `json:\"backend_details,omitempty\"`\n}\n```\nOverallHealthStatus represents the overall health status of the service.\n\n```go\ntype PathMatcher struct {\n\t// contains filtered or unexported fields\n}\n```\nPathMatcher helps determine which backend should handle a request based on path patterns. It maintains a mapping of backend IDs to URL path patterns and provides methods to register patterns and find matching backends for incoming requests.\n\n```go\nfunc NewPathMatcher() *PathMatcher\n```\nNewPathMatcher creates a new PathMatcher instance with initialized storage. This is used to create a fresh path matcher for route registration.\n\n```go\nfunc (pm *PathMatcher) AddRoutePattern(backendID, pattern string)\n```\nAddRoutePattern adds a path pattern that should be routed to the specified backend. Multiple patterns can be registered for the same backend.\n\nParameters:\n\n  - backendID: The identifier of the backend service to route to\n  - pattern: The URL path pattern to match (e.g., \"/api/users\")\n\n```go\nfunc (pm *PathMatcher) MatchBackend(path string) string\n```\nMatchBackend determines which backend should handle the given path. It checks if the path starts with any of the registered patterns and returns the matching backend ID. If multiple patterns match, the first match wins.\n\nParameters:\n\n  - path: The request path to match against registered patterns\n\nReturns:\n\n  - The matching backendID or empty string if no match is found\n\n```go\ntype PathRewritingConfig struct {\n\t// StripBasePath removes the specified base path from all requests before forwarding to backends\n\tStripBasePath string `json:\"strip_base_path\" yaml:\"strip_base_path\" toml:\"strip_base_path\" env:\"STRIP_BASE_PATH\"`\n\n\t// BasePathRewrite replaces the base path with a new path for all requests\n\tBasePathRewrite string `json:\"base_path_rewrite\" yaml:\"base_path_rewrite\" toml:\"base_path_rewrite\" env:\"BASE_PATH_REWRITE\"`\n\n\t// EndpointRewrites defines per-endpoint path rewriting rules\n\tEndpointRewrites map[string]EndpointRewriteRule `json:\"endpoint_rewrites\" yaml:\"endpoint_rewrites\" toml:\"endpoint_rewrites\"`\n}\n```\nPathRewritingConfig defines configuration for path rewriting rules.\n\n```go\ntype ResponseHeaderRewritingConfig struct {\n\t// SetHeaders defines headers to set or override on the response\n\tSetHeaders map[string]string `json:\"set_headers\" yaml:\"set_headers\" toml:\"set_headers\"`\n\n\t// RemoveHeaders defines headers to remove from the response\n\tRemoveHeaders []string `json:\"remove_headers\" yaml:\"remove_headers\" toml:\"remove_headers\"`\n}\n```\nResponseHeaderRewritingConfig defines configuration for response header rewriting rules.\n\n```go\ntype ResponseInfo struct {\n\tStatusCode   int               `json:\"statusCode\"`\n\tHeaders      map[string]string `json:\"headers,omitempty\"`\n\tBody         string            `json:\"body,omitempty\"`\n\tBodySize     int64             `json:\"bodySize\"`\n\tResponseTime time.Duration     `json:\"responseTime\"`\n\tError        string            `json:\"error,omitempty\"`\n}\n```\nResponseInfo contains information about a backend response.\n\n```go\ntype ResponseTransformer func(responses map[string]*http.Response) (*http.Response, error)\n```\nResponseTransformer is a function that can transform backend responses. It receives a map of backend responses (keyed by backend ID) and can modify them or create a new combined response. This allows for complex response manipulation like merging specific fields, data augmentation, etc.\n\n```go\ntype RetryFunc func(ctx context.Context) (interface{}, int, error)\n```\nRetryFunc represents a function that can be retried.\n\n```go\ntype RetryPolicy struct {\n\t// MaxRetries is the maximum number of retries to attempt.\n\tMaxRetries int\n\t// BaseDelay is the base delay between retries.\n\tBaseDelay time.Duration\n\t// MaxDelay is the maximum delay between retries.\n\tMaxDelay time.Duration\n\t// Jitter is the amount of randomness to add to the delay.\n\tJitter float64\n\t// RetryableStatusCodes is a list of status codes that should trigger a retry.\n\tRetryableStatusCodes map[int]bool\n\t// Timeout is the timeout for each attempt.\n\tTimeout time.Duration\n}\n```\nRetryPolicy defines the retry behavior for failing requests.\n\n```go\nfunc DefaultRetryPolicy() RetryPolicy\n```\nDefaultRetryPolicy returns a default retry policy.\n\n```go\nfunc (p RetryPolicy) CalculateBackoff(attempt int) time.Duration\n```\nCalculateBackoff calculates the backoff duration for a retry attempt.\n\n```go\nfunc (p RetryPolicy) ShouldRetry(statusCode int) bool\n```\nShouldRetry returns true if the status code should trigger a retry.\n\n```go\nfunc (p RetryPolicy) WithBaseDelay(baseDelay time.Duration) RetryPolicy\n```\nWithBaseDelay sets the base delay.\n\n```go\nfunc (p RetryPolicy) WithJitter(jitter float64) RetryPolicy\n```\nWithJitter sets the jitter.\n\n```go\nfunc (p RetryPolicy) WithMaxDelay(maxDelay time.Duration) RetryPolicy\n```\nWithMaxDelay sets the maximum delay.\n\n```go\nfunc (p RetryPolicy) WithMaxRetries(maxRetries int) RetryPolicy\n```\nWithMaxRetries sets the maximum number of retries.\n\n```go\nfunc (p RetryPolicy) WithRetryableStatusCodes(codes ...int) RetryPolicy\n```\nWithRetryableStatusCodes sets the status codes that should trigger a retry.\n\n```go\nfunc (p RetryPolicy) WithTimeout(timeout time.Duration) RetryPolicy\n```\nWithTimeout sets the timeout for each attempt.\n\n```go\ntype ReverseProxyConfig struct {\n\tBackendServices        map[string]string               `json:\"backend_services\" yaml:\"backend_services\" toml:\"backend_services\" env:\"BACKEND_SERVICES\"`\n\tRoutes                 map[string]string               `json:\"routes\" yaml:\"routes\" toml:\"routes\" env:\"ROUTES\"`\n\tRouteConfigs           map[string]RouteConfig          `json:\"route_configs\" yaml:\"route_configs\" toml:\"route_configs\"`\n\tDefaultBackend         string                          `json:\"default_backend\" yaml:\"default_backend\" toml:\"default_backend\" env:\"DEFAULT_BACKEND\"`\n\tCircuitBreakerConfig   CircuitBreakerConfig            `json:\"circuit_breaker\" yaml:\"circuit_breaker\" toml:\"circuit_breaker\"`\n\tBackendCircuitBreakers map[string]CircuitBreakerConfig `json:\"backend_circuit_breakers\" yaml:\"backend_circuit_breakers\" toml:\"backend_circuit_breakers\"`\n\tCompositeRoutes        map[string]CompositeRoute       `json:\"composite_routes\" yaml:\"composite_routes\" toml:\"composite_routes\"`\n\tTenantIDHeader         string                          `json:\"tenant_id_header\" yaml:\"tenant_id_header\" toml:\"tenant_id_header\" env:\"TENANT_ID_HEADER\" default:\"X-Tenant-ID\"`\n\tRequireTenantID        bool                            `json:\"require_tenant_id\" yaml:\"require_tenant_id\" toml:\"require_tenant_id\" env:\"REQUIRE_TENANT_ID\"`\n\tCacheEnabled           bool                            `json:\"cache_enabled\" yaml:\"cache_enabled\" toml:\"cache_enabled\" env:\"CACHE_ENABLED\"`\n\tCacheTTL               time.Duration                   `json:\"cache_ttl\" yaml:\"cache_ttl\" toml:\"cache_ttl\" env:\"CACHE_TTL\"`\n\tRequestTimeout         time.Duration                   `json:\"request_timeout\" yaml:\"request_timeout\" toml:\"request_timeout\" env:\"REQUEST_TIMEOUT\"`\n\tMetricsEnabled         bool                            `json:\"metrics_enabled\" yaml:\"metrics_enabled\" toml:\"metrics_enabled\" env:\"METRICS_ENABLED\"`\n\tMetricsPath            string                          `json:\"metrics_path\" yaml:\"metrics_path\" toml:\"metrics_path\" env:\"METRICS_PATH\"`\n\tMetricsEndpoint        string                          `json:\"metrics_endpoint\" yaml:\"metrics_endpoint\" toml:\"metrics_endpoint\" env:\"METRICS_ENDPOINT\"`\n\tHealthCheck            HealthCheckConfig               `json:\"health_check\" yaml:\"health_check\" toml:\"health_check\"`\n\t// BackendConfigs defines per-backend configurations including path rewriting and header rewriting\n\tBackendConfigs map[string]BackendServiceConfig `json:\"backend_configs\" yaml:\"backend_configs\" toml:\"backend_configs\"`\n\n\t// Debug endpoints configuration\n\tDebugEndpoints DebugEndpointsConfig `json:\"debug_endpoints\" yaml:\"debug_endpoints\" toml:\"debug_endpoints\"`\n\n\t// Dry-run configuration\n\tDryRun DryRunConfig `json:\"dry_run\" yaml:\"dry_run\" toml:\"dry_run\"`\n\n\t// Feature flag configuration\n\tFeatureFlags FeatureFlagsConfig `json:\"feature_flags\" yaml:\"feature_flags\" toml:\"feature_flags\"`\n\n\t// Global timeout configuration\n\tGlobalTimeout time.Duration `json:\"global_timeout\" yaml:\"global_timeout\" toml:\"global_timeout\" env:\"GLOBAL_TIMEOUT\"`\n\n\t// Metrics configuration\n\tMetricsConfig MetricsConfig `json:\"metrics_config\" yaml:\"metrics_config\" toml:\"metrics_config\"`\n\n\t// Debug configuration\n\tDebugConfig DebugConfig `json:\"debug_config\" yaml:\"debug_config\" toml:\"debug_config\"`\n\n\t// Dry run configuration\n\tDryRunConfig DryRunConfig `json:\"dry_run_config\" yaml:\"dry_run_config\" toml:\"dry_run_config\"`\n\n\t// Header management\n\tHeaderConfig HeaderConfig `json:\"header_config\" yaml:\"header_config\" toml:\"header_config\"`\n\n\t// Response header management\n\tResponseHeaderConfig ResponseHeaderRewritingConfig `json:\"response_header_config\" yaml:\"response_header_config\" toml:\"response_header_config\"`\n\n\t// Error handling configuration\n\tErrorHandling ErrorHandlingConfig `json:\"error_handling\" yaml:\"error_handling\" toml:\"error_handling\"`\n}\n```\nReverseProxyConfig provides configuration options for the ReverseProxyModule.\n\n```go\ntype ReverseProxyModule struct {\n\t// contains filtered or unexported fields\n}\n```\nReverseProxyModule provides a modular reverse proxy implementation with support for multiple backends, composite routes that combine responses from different backends, and tenant-specific routing configurations.\n\nThe module implements the following interfaces:\n\n  - modular.Module: Basic module lifecycle\n  - modular.Configurable: Configuration management\n  - modular.ServiceAware: Service dependency management\n  - modular.TenantAwareModule: Tenant lifecycle management\n  - modular.Startable: Startup logic\n  - modular.Stoppable: Shutdown logic\n\nKey features include:\n\n  - Multi-backend proxy routing with health checks\n  - Composite responses combining multiple backend calls\n  - Circuit breakers for fault tolerance\n  - Response caching for performance optimization\n  - Tenant-aware routing and configuration\n  - Request/response transformation pipelines\n  - Comprehensive metrics collection\n  - Path-based and header-based routing rules\n\n```go\nfunc NewModule() *ReverseProxyModule\n```\nNewModule creates a new ReverseProxyModule with default settings. This is the primary constructor for the reverseproxy module and should be used when registering the module with the application.\n\nThe module initializes with:\n\n  - Optimized HTTP client with connection pooling\n  - Circuit breakers for each backend\n  - Response caching infrastructure\n  - Metrics collection (if enabled)\n  - Thread-safe data structures for concurrent access\n\nExample:\n\n\tapp.RegisterModule(reverseproxy.NewModule())\n\n```go\nfunc (m *ReverseProxyModule) AddBackend(backendID, serviceURL string) error\n```\nAddBackend dynamically adds a new backend to the module at runtime and emits an event. It updates the configuration, creates the proxy, and (optionally) registers a default route if one matching the backend name does not already exist.\n\n```go\nfunc (m *ReverseProxyModule) AddBackendRoute(backendID, routePattern string) error\n```\nAddBackendRoute registers a new route for a specific backend. It allows dynamically adding routes to the reverse proxy after initialization.\n\n```go\nfunc (m *ReverseProxyModule) AddCompositeRoute(pattern string, backends []string, strategy string)\n```\nAddCompositeRoute adds a composite route that combines responses from multiple backends. The strategy parameter determines how the responses are combined.\n\n```go\nfunc (m *ReverseProxyModule) Constructor() modular.ModuleConstructor\n```\nConstructor returns a ModuleConstructor function that initializes the module with the required services. It expects a service that implements the routerService interface to register routes with.\n\n```go\nfunc (m *ReverseProxyModule) EmitEvent(ctx context.Context, event cloudevents.Event) error\n```\nEmitEvent implements the ObservableModule interface. This allows the reverseproxy module to emit events that other modules or observers can receive.\n\n```go\nfunc (m *ReverseProxyModule) GetBackendHealthStatus(backendID string) (*HealthStatus, bool)\n```\nGetBackendHealthStatus returns the health status of a specific backend.\n\n```go\nfunc (m *ReverseProxyModule) GetConfig() *ReverseProxyConfig\n```\nGetConfig returns the module's configuration.\n\n```go\nfunc (m *ReverseProxyModule) GetHealthStatus() map[string]*HealthStatus\n```\nGetHealthStatus returns the health status of all backends.\n\n```go\nfunc (m *ReverseProxyModule) GetOverallHealthStatus(includeDetails bool) *OverallHealthStatus\n```\nGetOverallHealthStatus returns the overall health status of all backends.\n\n```go\nfunc (m *ReverseProxyModule) GetRegisteredEventTypes() []string\n```\nGetRegisteredEventTypes implements the ObservableModule interface. Returns all event types that this reverseproxy module can emit.\n\n```go\nfunc (m *ReverseProxyModule) Init(app modular.Application) error\n```\nInit initializes the module with the provided application. It retrieves the module's configuration and sets up the internal data structures for each configured backend, including tenant-specific configurations.\n\n```go\nfunc (m *ReverseProxyModule) IsHealthCheckEnabled() bool\n```\nIsHealthCheckEnabled returns whether health checking is enabled.\n\n```go\nfunc (m *ReverseProxyModule) Name() string\n```\nName returns the name of the module. This is used by the modular framework to identify the module.\n\n```go\nfunc (m *ReverseProxyModule) OnTenantRegistered(tenantID modular.TenantID)\n```\nOnTenantRegistered is called when a new tenant is registered with the application. Instead of immediately querying for tenant configuration, we store the tenant ID and defer configuration loading until the next appropriate phase to avoid deadlocks.\n\n```go\nfunc (m *ReverseProxyModule) OnTenantRemoved(tenantID modular.TenantID)\n```\nOnTenantRemoved is called when a tenant is removed from the application. It removes the tenant's configuration and any associated resources.\n\n```go\nfunc (m *ReverseProxyModule) ProvidesServices() []modular.ServiceProvider\n```\nProvidesServices returns the services provided by this module. This module can provide a featureFlagEvaluator service if configured to do so, whether the evaluator was created internally or provided externally. This allows other modules to discover and use the evaluator.\n\n```go\nfunc (m *ReverseProxyModule) RegisterConfig(app modular.Application) error\n```\nRegisterConfig registers the module's configuration with the application. It also stores the provided app as a TenantApplication for later use with tenant-specific functionality.\n\n```go\nfunc (m *ReverseProxyModule) RegisterCustomEndpoint(pattern string, mapping EndpointMapping)\n```\nRegisterCustomEndpoint adds a custom endpoint with a response transformer. This provides the most flexibility for combining and transforming responses from multiple backends using custom logic.\n\n```go\nfunc (m *ReverseProxyModule) RegisterObservers(subject modular.Subject) error\n```\nRegisterObservers implements the ObservableModule interface. This allows the reverseproxy module to register as an observer for events it's interested in.\n\n```go\nfunc (m *ReverseProxyModule) RemoveBackend(backendID string) error\n```\nRemoveBackend removes an existing backend at runtime and emits a backend.removed event.\n\n```go\nfunc (m *ReverseProxyModule) RequiresServices() []modular.ServiceDependency\n```\nRequiresServices returns the services required by this module. The reverseproxy module requires a service that implements the routerService interface to register routes with, and optionally a http.Client and FeatureFlagEvaluator.\n\n```go\nfunc (m *ReverseProxyModule) SetHttpClient(client *http.Client)\n```\nSetHttpClient overrides the default HTTP client used by the module. This method can be used to customize the HTTP client with advanced settings such as custom timeouts, transport configurations, or for testing purposes. It should be called before the Start method.\n\nNote: This also updates the transport for all existing reverse proxies. This method is retained for backward compatibility, but using the httpclient service is recommended for new code.\n\n```go\nfunc (m *ReverseProxyModule) SetResponseHeaderModifier(modifier func(*http.Response, string, modular.TenantID) error)\n```\nSetResponseHeaderModifier sets a custom function to modify response headers dynamically. The function receives the response, backend ID, and tenant ID, allowing for dynamic header manipulation based on backend, tenant, or response content.\n\nExample use case: Dynamically consolidate CORS headers from multiple backends.\n\n```go\nfunc (m *ReverseProxyModule) SetResponseTransformer(pattern string, transformer ResponseTransformer)\n```\nSetResponseTransformer sets a custom response transformer for a specific composite route pattern. The transformer receives responses from all backends and can create a custom merged response.\n\n```go\nfunc (m *ReverseProxyModule) Start(ctx context.Context) error\n```\nStart sets up all routes for the module and registers them with the router. This includes backend routes, composite routes, and any custom endpoints.\n\n```go\nfunc (m *ReverseProxyModule) Stop(ctx context.Context) error\n```\nStop performs any cleanup needed when stopping the module. This method gracefully shuts down active connections and resources.\n\n```go\ntype RouteConfig struct {\n\t// FeatureFlagID is the ID of the feature flag that controls whether this route uses the primary backend\n\t// If specified and the feature flag evaluates to false, requests will be routed to the alternative backend\n\tFeatureFlagID string `json:\"feature_flag_id\" yaml:\"feature_flag_id\" toml:\"feature_flag_id\" env:\"FEATURE_FLAG_ID\"`\n\n\t// FeatureFlag is an alternative name for FeatureFlagID\n\tFeatureFlag string `json:\"feature_flag\" yaml:\"feature_flag\" toml:\"feature_flag\" env:\"FEATURE_FLAG\"`\n\n\t// AlternativeBackend specifies the backend to use when the feature flag is disabled\n\t// If FeatureFlagID is specified and evaluates to false, requests will be routed to this backend instead\n\tAlternativeBackend string `json:\"alternative_backend\" yaml:\"alternative_backend\" toml:\"alternative_backend\" env:\"ALTERNATIVE_BACKEND\"`\n\n\t// AlternativeBackends is a list of alternative backends\n\tAlternativeBackends []string `json:\"alternative_backends\" yaml:\"alternative_backends\" toml:\"alternative_backends\" env:\"ALTERNATIVE_BACKENDS\"`\n\n\t// CompositeBackends defines multiple backends for composite responses\n\tCompositeBackends []string `json:\"composite_backends\" yaml:\"composite_backends\" toml:\"composite_backends\" env:\"COMPOSITE_BACKENDS\"`\n\n\t// PathRewrite defines path rewriting for this route\n\tPathRewrite string `json:\"path_rewrite\" yaml:\"path_rewrite\" toml:\"path_rewrite\" env:\"PATH_REWRITE\"`\n\n\t// Timeout defines a custom timeout for this route\n\tTimeout time.Duration `json:\"timeout\" yaml:\"timeout\" toml:\"timeout\" env:\"TIMEOUT\"`\n\n\t// DryRun enables dry-run mode for this route, sending requests to both backends and comparing responses\n\t// When true, requests are sent to both the primary and alternative backends, but only the alternative backend's response is returned\n\tDryRun bool `json:\"dry_run\" yaml:\"dry_run\" toml:\"dry_run\" env:\"DRY_RUN\"`\n\n\t// DryRunBackend specifies the backend to compare against in dry-run mode\n\t// If not specified, uses the AlternativeBackend for comparison\n\tDryRunBackend string `json:\"dry_run_backend\" yaml:\"dry_run_backend\" toml:\"dry_run_backend\" env:\"DRY_RUN_BACKEND\"`\n}\n```\nRouteConfig defines feature flag-controlled routing configuration for specific routes. This allows routes to be dynamically controlled by feature flags, with fallback to alternative backends.\n\n```go\ntype WeightedEvaluator interface {\n\tFeatureFlagEvaluator\n\t// Weight returns the priority weight for this evaluator.\n\t// Lower values = higher priority. Default is 100 if not implemented.\n\tWeight() int\n}\n```\nWeightedEvaluator is an optional interface that FeatureFlagEvaluator implementations can implement to specify their priority in the evaluation chain. Lower weight values indicate higher priority (evaluated first). Default weight for evaluators that don't implement this interface is 100. The built-in file evaluator has weight 1000 (lowest priority/last fallback).\n\n","path":"github.com/CrisisTextLine/modular/modules/reverseproxy/v2","name":"reverseproxy","synopsis":"Package reverseproxy provides circuit breaker implementation for backend proxies.","isRedistributable":true}
