[ https://issues.apache.org/jira/browse/NIFI-1860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15275999#comment-15275999 ]
ASF GitHub Bot commented on NIFI-1860: -------------------------------------- GitHub user ijokarumawak opened a pull request: https://github.com/apache/nifi/pull/422 NIFI-1860 Added ContainerRequestFilter to redirect - redirect /controller to /site-to-site You can merge this pull request into a Git repository by running: $ git pull https://github.com/ijokarumawak/nifi nifi-1860 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/422.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #422 ---- commit 9abb4a27a39c8ed8f0ba0f3ab52202a3cc5010a6 Author: ijokarumawak <ijokaruma...@gmail.com> Date: 2016-05-09T06:18:25Z NIFI-1860 Added ContainerRequestFilter to redirect - redirect /controller to /site-to-site ---- > Backward compatibility for Site-to-Site client > ---------------------------------------------- > > Key: NIFI-1860 > URL: https://issues.apache.org/jira/browse/NIFI-1860 > Project: Apache NiFi > Issue Type: Sub-task > Components: Core Framework > Reporter: Koji Kawamura > Fix For: 1.0.0 > > > 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. > {code:title=EndpointConnectionPool.java} > 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); > {code} > 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 -- This message was sent by Atlassian JIRA (v6.3.4#6332)