Enhance error handling in gateway and configuration
- Added `expose_upstream_errors` option to the configuration, allowing detailed error messages in JSON responses for 502 errors. - Implemented `writeBadGatewayJSON` function to streamline JSON error responses, including upstream error details when enabled. - Updated documentation to reflect changes in configuration and error handling behavior for improved diagnostics.
This commit is contained in:
@@ -15,8 +15,10 @@ var aliasRe = regexp.MustCompile(`^[a-z0-9][a-z0-9_-]*$`)
|
||||
|
||||
// Config is the gateway YAML configuration.
|
||||
type Config struct {
|
||||
Listen string `yaml:"listen"`
|
||||
AllowAll bool `yaml:"allow_all"`
|
||||
Listen string `yaml:"listen"`
|
||||
// ExposeUpstreamErrors puts RoundTrip error text in JSON 502 bodies (error.detail). For private ops only.
|
||||
ExposeUpstreamErrors bool `yaml:"expose_upstream_errors"`
|
||||
AllowAll bool `yaml:"allow_all"`
|
||||
WhitelistCIDRs []string `yaml:"whitelist_cidrs"`
|
||||
TrustedProxies []string `yaml:"trusted_proxies"`
|
||||
CorsAllowedOrigins []string `yaml:"cors_allowed_origins"`
|
||||
|
||||
Reference in New Issue
Block a user