Add response headers documentation incorrect
See original GitHub issueAccording to documentation add_response_headers
accepts string
, bool
or object
as shown in the example Mapping
:
apiVersion: getambassador.io/v3alpha1
kind: Mapping
metadata:
name: quote-backend
spec:
prefix: /backend/
add_response_headers:
x-test-proto: "%PROTOCOL%"
x-test-ip: "%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%"
x-test-static: This is a test header
x-test-object:
append: False
value: this is from object header config
service: quote
When using anything other than an object
you receive error message:
error: error validating "mapping.yaml": error validating data: ValidationError(Mapping.spec.add_response_headers.x-test-proto): invalid type for io.getambassador.v3alpha1.Mapping.spec.add_response_headers: got "string", expected "map"; if you choose to ignore these errors, turn validation off with --validate=false
Looking at the CRD definitions (if my understanding is correct):
spec:
description: MappingSpec defines the desired state of Mapping
properties:
add_linkerd_headers:
type: boolean
add_request_headers:
type: object
x-kubernetes-preserve-unknown-fields: true
add_response_headers:
type: object
x-kubernetes-preserve-unknown-fields: true
It looks like it only accepts an object
.
Steps to reproduce the behavior:
- Create mapping example as shown in the documentation
This error is present on the latest version 2.2.2
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Is there any documentation for response headers when ...
Hello. When we send request for data and put invalid attribute, we receive response with code 400 (Bad Reqeust). This is perfectly fine....
Read more >How to troubleshoot the error "Failed to process response ...
In almost every event, this error is caused by a connection failure. The error is correct, the service did not receive any response...
Read more >HTTP headers - MDN Web Docs - Mozilla
An HTTP header consists of its case-insensitive name followed by a colon ( : ), then by its value. Whitespace before the value...
Read more >Code Inspection: Incorrect HTTP header - PhpStorm - JetBrains
Reports unknown HTTP headers that do not match any publicly known headers. The quick fix suggests adding the header to the list of...
Read more >Adding HTTP headers to CloudFront responses
Use a response headers policy to specify the HTTP headers that Amazon CloudFront adds to HTTP responses.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Following solution worked for me
thanks @cindymullins-dw
This is still broken. @so-amuk 's solution works, but that’s just an alternative to defining the headers directly as strings. Even the docs mention both options are supported. The example from the docs isn’t working.
Is this a bug in the schema generation?