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

URL rewrite at the agent web server to support multiple dashboard versions #15247

Merged
merged 9 commits into from Jun 26, 2023

Conversation

ktsaou
Copy link
Member

@ktsaou ktsaou commented Jun 23, 2023

This PR fixes the URL rewrite to work like this:

  1. /v0/, /v1/, /v2/ are now handled in the code.
  2. /vN/ together with /host/NAME/ and /node/ID/ work in parallel, both as /v2/host/X/ and /host/X/v2/.
  3. /vN/ works also for API requests as /v2/api/v1/endpoint.
  4. When the last component of the URL (before the query string) has a filename extension, it is treated as filename that needs to be loaded as-is. So, now we don't scans paths. Either the file exists or does not exist. The only fallback is that if there is a version and the filename does not exist in the path with the version, we remove the version and retry.
  5. Added the ability to send relative redirects from the agent, to support environments where netdata is installed behind an authenticated proxy.

Tested all dashboards (old, v1, v2) and all work ok with this.

@stelfrag
Copy link
Collaborator

Using localhost:19999/v0 will display file does not exist -- same with v1 and v2

However localhost:19999/v3 and localhost:19999/v3/ act a bit different (any localhost:19999/bad_path)

localhost:19999/v3 displays a pop up Cannot load required JS library: dashboard_info.js
And the following are failing

v3/css/version.txt
v3/css/bootstrap-3.3.7.css
v3/css/dashboard.css?v20180210-1
v3/dashboard_info.js

but then it goes on to request v3//api/v1/alarms?active every few seconds

With localhost:19999/v3/ the following fail

v3/static/css/2.c454aab8.chunk.css
v3/static/css/main.53ba10f1.chunk.css
v3/dashboard-react.js
v3/static/js/2.fbe8638b.chunk.js
v3/static/js/main.15e0c54f.chunk.js
v3//version.txt

no attempt to get alarms?active


In both cases localhost:19999/v3 and ``localhost:19999/v3/` the screen is stuck showing

                netdata
Real-time performance monitoring, done right!

@ktsaou
Copy link
Member Author

ktsaou commented Jun 24, 2023

@stelfrag for all the dashboards to work we need #15200.

Only v1 at the root and old are available with this PR against master.

v3 is not handled by the code. So, it works like any other directory.

@ktsaou
Copy link
Member Author

ktsaou commented Jun 24, 2023

@stelfrag check my test1 branch. It has all these merged together.

@ktsaou
Copy link
Member Author

ktsaou commented Jun 24, 2023

The problem with unknown directories (or directories without an index.html in them) is that the new UI puts its own routing information in the URL path. So, when the user asks for a non-existing path, we serve /index.html assuming that the UI will handle the situation.

@ktsaou ktsaou merged commit ff0b64d into netdata:master Jun 26, 2023
128 of 130 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants