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

fix rpc on web server over http/s #7377

Merged
merged 1 commit into from
Jul 5, 2023
Merged

Conversation

guymguym
Copy link
Member

@guymguym guymguym commented Jul 5, 2023

Explain the changes

  1. web server express app initialization was wrong as it installed the rpc route at the end after the last error handler route, which hides everything after it.
  2. This was not a problem for ws/wss access to the rpc, but did not allow http/https access.
  3. Fixed by moving the initialization to be called only from inside main.
  4. Also fixed the error handling for rpc http to destroy the response connection.

Issues: Fixed #xxx / Gap #xxx

  1. NA

Testing Instructions:

  1. npm run db:init
  2. npm run db (keeps running)
  3. npm run db:create
  4. npm run web (keeps running)
  5. make an http rpc call:
> curl http://127.0.0.1:5001/rpc/ -sd '{ "api":"system_api", "method":"get_system_status" }' | jq
{
  "op": "res",
  "reqid": "1@http://::ffff:127.0.0.1:54324(1lwr449y.z92)",
  "took": 0.9169590473175049,
  "reply": {
    "state": "READY",
    "last_state_change": 1688549106495
  }
}

Signed-off-by: Guy Margalit <guymguym@gmail.com>
@guymguym guymguym merged commit ef8ca7a into noobaa:master Jul 5, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants