[ 
https://issues.apache.org/jira/browse/KAFKA-9768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17067275#comment-17067275
 ] 

ASF GitHub Bot commented on KAFKA-9768:
---------------------------------------

C0urante commented on pull request #8360: KAFKA-9768: Fix handling of 
rest.advertised.listener config
URL: https://github.com/apache/kafka/pull/8360
 
 
   [Jira](https://issues.apache.org/jira/browse/KAFKA-9768)
   
   The `rest.advertised.listener` config is currently broken as setting it to 
`http` when listeners are configured for both `https` and `http` will cause the 
framework to choose whichever of the two listeners is listed first. The changes 
here attempt to fix this by checking not only that `Connector::getName` begins 
with the specified protocol, but also that that protocol is immediately 
followed by an underscore, which Jetty appears to use as a delimiter between 
the protocol and the remainder of the connector name.
   
   An existing unit test for the `RestServer::advertisedUrl` method has been 
expanded to include a case that fails with the framework in its current state 
and passes with the changes in this PR.
   
   It's unclear how the name for a Jetty `Connector` is calculated; it would be 
good to get assurances on that front before merging any changes relying on the 
name matching a given format. Opening this PR now to hopefully get some 
visibility into that and also to get review on the changes assuming they align 
with how Jetty works.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> 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
>            Priority: Major
>
> 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)

Reply via email to