kafka-rest
kafka-rest copied to clipboard
CORS - Response does not include Access-Control headers for GET request
I configure CORS settings in kafka-rest.properties file as follow:
access.control.allow.origin=* access.control.allow.methos="GET,POST,PUT,DELETE"
The responses for POST - DELETE requests have Access-Control values in header. However, the GET requests does not have them and Browser may reject the response.
1- If the GET request does not contain Content-Type header, Browser accept the response. 2- If the GET request contains Content-Type header (ex: Content-Type: application/vnd.kafka.json.v2+json), Browser will reject the response.
Confluent Kafka REST should return Access-Control in response because it is configured in the kafka-rest.properties file.
same issue.
access.control.allow.origin=* access.control.allow.methods=GET,POST,PUT,DELETE
Same issue. Is there any update?
same issue.
Same issue. Also do we have support for Access-Control-Allow-Headers?
Same issue here.
Same
Same issue.
Same issue. its already configured by default but im still getting CONNECTION ERROR through reverse-proxy(Traefik).. but directly it works..
@ewencp Can any of the devs comment?
Same problem, has this been looked at?
Same problem here, but after some time spent looking at the code, i saw that the class io.confluent.rest.RestConfig has one more related property access.control.allow.headers
that can be set. Setting this property makes everything works correctly.
At the documentation of kafka-rest this property isn't listed.
To use CORS on kafka-rest we need to set this 3 lines at the kafka-rest.properties:
access.control.allow.origin=*
access.control.allow.methos=GET,POST,PUT,DELETE
access.control.allow.headers=origin,content-type,accept,authorization
Thank you @jairsjunior To expound on it, I had to modify the file kafka-rest.properties inside ../confluent-6.0.0/etc/kafka-rest folder, then restart the REST server.
For the ones using the docker-compose file that would correspond to the environment entries:
environment:
...
KAFKA_REST_ACCESS_CONTROL_ALLOW_ORIGIN: "*"
KAFKA_REST_ACCESS_CONTROL_ALLOW_METHODS: "GET,POST,PUT,DELETE"
KAFKA_REST_ACCESS_CONTROL_ALLOW_HEADERS: "origin,content-type,accept,authorization"