[PR #771] Add grpc keep alive for management service #2868

Open
opened 2025-11-20 08:04:14 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/771

State: closed
Merged: No


Describe your changes

Application level keep alive PoC for gRPC.

The concept is that mgmt server send the keep alive messages
periodically.
Because the current setup does not support the both way communication
the server inject keep alive (empty) messages in the Sync stream. So
the keep alive procedure will start after the Sync call happens.

The application level keep alive will be applied only on that case when the
server is behind reveres proxy. The server check it with the proper
HTTP headers to ensure to necessary this feature or not.

Because in the client has a bug what can cause exception I involved
the version information into the gRPC function calls and the server
send keep alive messages only if it is supported by the client.

Example nginx config:

server {
  listen *:80 http2;

  server_name signal.localhost;

  location / {
    grpc_set_header x-netbird-peer '$remote_addr:$remote_port';
    grpc_pass grpc://0.0.0.0:82;
  }
}

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/771 **State:** closed **Merged:** No --- ## Describe your changes Application level keep alive PoC for gRPC. The concept is that mgmt server send the keep alive messages periodically. Because the current setup does not support the both way communication the server inject keep alive (empty) messages in the Sync stream. So the keep alive procedure will start after the Sync call happens. The application level keep alive will be applied only on that case when the server is behind reveres proxy. The server check it with the proper HTTP headers to ensure to necessary this feature or not. Because in the client has a bug what can cause exception I involved the version information into the gRPC function calls and the server send keep alive messages only if it is supported by the client. Example nginx config: ``` server { listen *:80 http2; server_name signal.localhost; location / { grpc_set_header x-netbird-peer '$remote_addr:$remote_port'; grpc_pass grpc://0.0.0.0:82; } } ``` ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary
saavagebueno added the pull-request label 2025-11-20 08:04:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#2868