wangjialing218 opened a new pull request, #17063: URL: https://github.com/apache/pulsar/pull/17063
### Motivation [PIP 61](https://github.com/apache/pulsar/wiki/PIP-61%3A-Advertised-multiple-addresses) and [PIP 95](https://github.com/apache/pulsar/issues/12040) supports multiple advertised address for binary port. For HTTP port, currently we do not have a way to support multiple advertised address. Consider we are deploying a broker that can be accessed through both private network (for example 192.168.0.1) and public network (for example 10.175.100.1), we could configure multiple advertised listener for binary port, Pulsar client could access broker through both private and public network with correct listener name. For HTTP address, we could only configure one advertised address through internal listener: https://github.com/apache/pulsar/blob/0cf2a7534cbcdffe7574af1ee3717fa3f7ed8ba4/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java#L1613 If we configure private address(192.168.0.1) for HTTP address, we may not execute some PulsarAdmin API from public network, since some http request (for example get topics' stats) may get 307 response code and redirect to another broker's private address. ### Modifications Configure multiple advertised http address in `advertisedListeners` together with binary address. > advertisedListeners=internal:pulsar://192.168.0.1:6650,internal:http://192.168.0.1:8080,external:pulsar://10.175.100.1:6650,external:http://10.175.100.1:8080 Broker: For HTTP request, get listener name from request header `X-Pulsar-ListenerName`, use the listener name for topic lookup and topic owner verification, return advertised http address in case of http redirect. Pulsar Admin: Add `listenerName` to `PulsarAdminBuilder`, and set listener name to HTTP request header `X-Pulsar-ListenerName`. ### Verifying this change This change added tests and can be verified as follows: MultiHTTPAdvertisedListenersTest ### Documentation Check the box below or label this PR directly. Need to update docs? - [x] `doc-required` Need to update doc for configuration multiple HTTP address after PR accecpt. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
