Add user hook URL support for API access validation

- Forward all original HTTP headers plus custom rttys headers:
  - X-Rttys-Hook: true
  - X-Original-Method: original request method
  - X-Original-URL: original request URL
- Hook must return HTTP 200 to allow API access.

This enables external services to validate and control user API access
by receiving the complete original request context through HTTP hooks.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
Jianhui Zhao
2025-07-14 13:08:02 +08:00
parent 346065a428
commit 6c36d6d1c8
4 changed files with 70 additions and 0 deletions

View File

@@ -17,6 +17,14 @@
# Return HTTP 200 to indicate that the device is allowed to connect.
#dev-hook-url: http://127.0.0.1:8080/rttys-dev-hook
# This URL will be called when the user accesses APIs if this URL is configured.
# Rttys will pass all original headers, along with several additional specific headers:
# X-Rttys-Hook: true
# X-Original-Method: original request method
# X-Original-URL: original request URL
# Return HTTP 200 to indicate that the user is allowed to access the API.
#user-hook-url: http://127.0.0.1:8080/rttys-user-hook
# Local access does not require authentication
#local-auth: false