envoyproxy / envoyproxy/gateway
BackendTrafficPolicy responseOverride support request header matching
- Dominant language
- Go
- Stars
- 3k
- Forks
- 864
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 140
Description
*Description*:
Currently, we only support `statusCode` matching, e.g.
```yaml
responseOverride:
- match:
statusCodes:
- type: Range
range:
start: 500
end: 599
- type: Value
value: 403
response:
contentType: text/html
header:
set:
# some extra header
- name: x-envoy-custom-error
value: custom-500-page
# or user-friendly body
body:
type: ValueRef
valueRef:
group: ""
kind: ConfigMap
name: my-dynamic-error-template
```
It would be great if we also support the `Accept` request header so that we can return custom JSON for API routes, but keep the html page for request that are rendered in the browser.
This is something that was present in [ingress-nginx](https://kubernetes.github.io/ingress-nginx/user-guide/custom-errors/)
> A custom error backend can use this information to return the best possible representation of an error page. For example, if the value of the Accept header send by the client was application/json, a carefully crafted backend could decide to return the error payload as a JSON document instead of HTML.
[optional *Relevant Links*:]
https://gateway.envoyproxy.io/docs/api/extension_types/#customresponsematch
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.