Chris Egerton created KAFKA-9768:
------------------------------------
Summary: rest.advertised.listener configuration is not handled
properly by the worker
Key: KAFKA-9768
URL: https://issues.apache.org/jira/browse/KAFKA-9768
Project: Kafka
Issue Type: Bug
Components: KafkaConnect
Reporter: Chris Egerton
Assignee: Chris Egerton
The {{rest.advertised.listener}} config can currently be set to either "http"
or "https", and a listener with that protocol should be used when advertising
the URL of the worker to other members of the Connect cluster.
For example, someone might configure their worker with a {{rest.listeners}}
value of {{https://localhost:42069,http://localhost:4761}} and a
{{rest.advertised.listener}} value of {{http}}, which should cause the worker
to listen on port {{42069}} with TLS and port {{4761}} with plaintext, and
advertise the URL {{http://localhost:4761}} to other workers.
However, the worker instead advertises the URL {{https://localhost:42069}} to
other workers. This is because the {{RestServer}} class, which is responsible
for determining which URL to advertise to other workers, simply [chooses the
first listener whose name begins with the
protocol|https://github.com/apache/kafka/blob/0f48446690e42b78a9a6b8c6a9bbab9f01d84cb1/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/RestServer.java#L422]
specified in the {{rest.advertised.listener}} config.
This breaks because "http" is a prefix of "https", so if the advertised
listener is "http" but the first listener that's found starts with "https://",
that listener will still be chosen.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)