l8web

Web Server

REST web server framework for Layer 8 services.

Overview

L8Web provides RESTful HTTP and GraphQL endpoints, webhook handling, reverse proxy capabilities, and client libraries. It integrates with the Layer 8 network overlay for secure web-based access to distributed services.

REST Server

Full HTTP REST: GET, POST, PUT, PATCH, DELETE
Native Protocol Buffers serialization via protojson
TLS/HTTPS with automatic certificate generation
Multi-layer authentication: bearer token, API key, two-factor
Service discovery via Layer 8 VNet
Dynamic plugin loading with hot-reload
Web UI serving with SPA support and directory-level routing

Webhook Handler

Pluggable webhook provider system. Built-in providers for GitHub (X-GitHub-Event header, HMAC-SHA256 signature verification) and GitLab (X-Gitlab-Event header, secret token verification). Parses commit messages for issue references (Fixes #42, Closes L8B-123). POST-only enforcement.

Reverse Proxy

SNI-based TLS routing for multi-domain certificate selection
Multi-domain support with per-domain configuration
Multi-port support (443, 14443, 9092, 9094, 5444, 3114, 2883)
SSL termination with automatic certificate management
Full WebSocket protocol proxying

REST Client

Connection pooling with bearer token or API key authentication
Custom CA certificate support with certificate pinning
GZIP compression with automatic content negotiation
Retry logic: 5-second backoff, up to 5 attempts on timeout

GraphQL Client

Query and mutation operations with variable support
Automatic mapping of GraphQL responses to Protocol Buffer messages
Bearer token and API key authentication
Built-in retry mechanism

Authentication

Token extraction priority: Authorization header, bToken cookie, query parameter. Built-in endpoints for login (/auth), registration (/register), CAPTCHA (/captcha), TFA setup (/tfaSetup), and type registry access (/registry).

Project Structure

web/server/
REST server, service handler, auth, TFA, UI serving
web/client/
REST client with auth and retry
web/gclient/
GraphQL client
web/webhook/
Core handler, signature verification, issue reference extraction, GitHub/GitLab providers
web/proxy/
SNI-based reverse proxy with Kubernetes DaemonSet config

Testing

Test suite covers REST server creation, service registration, client-server communication, Protocol Buffer serialization, authentication flows, adjacent VNet token mapping, webhook handling, GitHub provider verification, HMAC-SHA256 signatures, and issue reference extraction.