Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
NIFI-1554 has moved /nifi-api/controller to /nifi-api/site-to-site/ .
However, Site-to-Site client is not updated yet, and it still sends a request to /nifi-api/controller to obtain information for Site-to-Site.
private ControllerDTO refreshRemoteInfo() throws IOException { final boolean webInterfaceSecure = clusterUrl.toString().startsWith("https"); final NiFiRestApiUtil utils = new NiFiRestApiUtil(webInterfaceSecure ? sslContext : null); final ControllerDTO controller = utils.getController(apiUri + "/controller", commsTimeout);
We can simply change the URL to "/site-to-site", but if we do so, old version of NiFi won't be able to communicate with the new version of NiFi via Site-to-Site.
Possible approaches to provide backward compatibility are:
- A. keep the old endpoint and let it respond with 301 Moved Permanently
- B. add a ContainerRequestFilter to modify requested url
- C. Jetty Rewrite Handler http://www.eclipse.org/jetty/documentation/current/rewrite-handler.html
Similarly when new version of NiFi tries to communicate with old version of NiFi, it has to send request to /controller, instead of /site-to-site. For this scenario, adding retry logic in new version of SIte-to-SIte client would be sufficient.
- Send request to /site-to-site
- If response code is 404 or 405, then retry sending request to /controller