Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROPOSAL] Support legacy basePath to re-direct to new basePath #907

Closed
yilintao-amzn opened this issue Nov 4, 2021 · 7 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@yilintao-amzn
Copy link

yilintao-amzn commented Nov 4, 2021

EDIT: this description was updated to avoid confusion.

Describe the feature

Say one user had a version of Kibana and they defined the server.basePath: /legacyApp, this will start up the application as localhost:5601/legacyApp. Any saved links will be saved into the system index as localhost:5601/legacyApp/viz or any if anyone bookmarked localhost:5601/legacyApp. If any service decided to migrate from the legacy application to OpenSearch Dashboards and decided to change server.basePath: /currentApp, then the application will start up as localhost:5601/currentApp. This then means the link localhost:5601/legacyApp/viz or bookmarks will fail.

Given that server.basePath can be anything that users define, it could be server.basePath: /foobar12345, this will start up the application as localhost:5601/foobar12345, we can't create a hardcode string to redirect (as suggested in the original issue here: /_plugin/kibana to /_dashboards).

So the suggestion here is define a new config that accepts a legacy config so that the url forwarder src file can forward users from the legacy base url to the current url if the legacy base url is defined.

To Reproduce
Steps to reproduce the behavior:

  1. Create a legacy app with 6.8 and upgrade to OpenSearch Dashboards 1.0
  2. Try to access dashboards

Expected behavior
Dashboards should work fine.

OpenSearch Version
1.0.

Dashboards Version
1.0.

Plugins

Please list all plugins currently enabled.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

@yilintao-amzn yilintao-amzn added bug Something isn't working untriaged labels Nov 4, 2021
@kavilla kavilla self-assigned this Nov 5, 2021
@tmarkley
Copy link
Contributor

@kavilla Rocky this is still assigned to you, are you working on a fix? Can we address both this and #665 with a generic solution?

@kavilla
Copy link
Member

kavilla commented Nov 15, 2021

Reflecting now I actually don't think this is related to #665. It might be worth to close this issue.

This problem comes from migrating server.basePath: /_plugin/kibana to server.basePath: /_dashboards in the config file. Should the solution here to have a config for server.basePathLegacy or something so we can have a reroute that is customizable?

@kavilla
Copy link
Member

kavilla commented Dec 9, 2021

Modify to proposal? to support if people want to support re-route from an old path to a new path.

@kavilla kavilla added enhancement New feature or request and removed bug Something isn't working labels Dec 9, 2021
@kavilla kavilla changed the title [BUG] Redirect from '/_plugin/kibana" to "/_dashboards" not working for Domain migrated from 6.8 to OSD 1.0 [PROPOSAL] Redirect from '/_plugin/kibana" to "/_dashboards" not working for Domain migrated from 6.8 to OSD 1.0 Dec 9, 2021
@kavilla kavilla changed the title [PROPOSAL] Redirect from '/_plugin/kibana" to "/_dashboards" not working for Domain migrated from 6.8 to OSD 1.0 [PROPOSAL] Support legacy basePath to re-direct to new basePath Dec 9, 2021
@kavilla kavilla removed their assignment Dec 13, 2021
@seraphjiang
Copy link
Member

@yilintao-amzn @kavilla

It is not clear to me what does reproduce steps mean?

what does domain mean?

what's the config settings for 6.8, what is the url try to access, and what is expected?
what's the config settings for OSD 1.0, what's the url try to access, and what is expected?

The redirect requirement is also ambitious to me, do we expect multiple 301 http redirect, or we URL rewrite is more close to what expected?

@kavilla
Copy link
Member

kavilla commented Apr 8, 2022

Domain probably shouldn't have been mentioned.

Say one user had a version of Kibana and they defined the server.basePath: /legacyApp, this will start up the application as localhost:5601/legacyApp. Any saved links will be saved into the system index as localhost:5601/legacyApp/viz or any if anyone bookmarked localhost:5601/legacyApp. If any service decided to migrate from the legacy application to OpenSearch Dashboards and decided to change server.basePath: /currentApp, then the application will start up as localhost:5601/currentApp. This then means the link localhost:5601/legacyApp/viz or bookmarks will fail.

Given that server.basePath can be anything that users define, it could be server.basePath: /foobar12345, this will start up the application as localhost:5601/foobar12345, we can't create a hardcode string to redirect (as suggested in the original issue here: /_plugin/kibana to /_dashboards).

So the suggestion here is define a new config that accepts a legacy config so that the url forwarder src file can forward users from the legacy base url to the current url if the legacy base url is defined.

@seraphjiang
Copy link
Member

Domain probably shouldn't have been mentioned.

Say one user had a version of Kibana and they defined the server.basePath: /legacyApp, this will start up the application as localhost:5601/legacyApp. Any saved links will be saved into the system index as localhost:5601/legacyApp/viz or any if anyone bookmarked localhost:5601/legacyApp. If any service decided to migrate from the legacy application to OpenSearch Dashboards and decided to change server.basePath: /currentApp, then the application will start up as localhost:5601/currentApp. This then means the link localhost:5601/legacyApp/viz or bookmarks will fail.

Given that server.basePath can be anything that users define, it could be server.basePath: /foobar12345, this will start up the application as localhost:5601/foobar12345, we can't create a hardcode string to redirect (as suggested in the original issue here: /_plugin/kibana to /_dashboards).

So the suggestion here is define a new config that accepts a legacy config so that the url forwarder src file can forward users from the legacy base url to the current url if the legacy base url is defined.

Thanks @kavilla for the explanation, it clear all my doubt 👍

@Flyingliuhub Flyingliuhub self-assigned this Apr 13, 2022
@Flyingliuhub
Copy link
Member

Root Cause

This issue actually happened when user created permalink in the 6.x ~7.8, and upgrade domain from (6.x ~ 7.8) to OSD 1.0, 1.1, 1.2, the permalink was writing to index url element with /app/kibana#/visualize/, it caused the trouble for rendering in the OSD1.0, 1.1, 1.2, the link will be broken as "application was not found."

      {
        "_index" : ".kibana_92668751_admin_2",
        "_type" : "_doc",
        "_id" : "url:4010a54fcf8a29e11d328119e199d21e",
        "_score" : 1.0,
        "_source" : {
          "url" : {
            "url" : "/app/kibana#/visualize/edit/****",
            "accessCount" : 10,
            "createDate" : "2022-04-13T19:14:44.083Z",
            "accessDate" : 1649882069317
          },
          "type" : "url",
          "references" : [ ],
          "updated_at" : "2022-04-13T20:34:29.317Z"
        }
      }

Fixes

The fixes already merged in OSD1.3, it will handle the forwarding from /app/kibana#/visualize/ to /app/visualize#/. Verified the fixes in the OSD1.3, the forwarding works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants