Skip to main content

HTTP Server & Resolvers

Hub extends the localhost HttpServer with security filtering and tunnel routing, and provides 16 specialized HTTP resolvers for API access, file handling, agent communication, and more.

HttpServer​

HttpProcessor/HttpServer.ts extends the localhost HttpServer with two Hub-specific behaviors:

Security Filtering​

The isRequestAllowed() method blocks requests to common attack vectors before they reach any resolver:

Blocked PatternReason
/.git/Git repository exposure
/.svnSVN repository exposure
/webdav/WebDAV probing
/wp-includes/, /wp-admin/WordPress exploit attempts
*.jspJava Server Pages probing
*.cgiCGI script probing

Tunnel Routing​

The resolveRequest() method checks the Host (or X-Forwarded-Host) header against configured tunnels.server aliases. When a match is found, the request is transparently rerouted:

  • Root path (/) → /forward (agent landing page)
  • Any other path → /forward/continue (proxied request to agent)

This allows agents to be accessed via dedicated subdomains without any client-side awareness of the forwarding mechanism.

Resolver Catalog​

All resolvers are in HttpProcessor/Resolvers/ and use the @Resolver decorator to register their URL patterns.

API Resolvers​

ResolverURL PatternAuthPurpose
RESTResolver/api/{section}/...Bearer tokenREST API with up to 6 nested path segments. Validates Bearer token or falls back to service account authentication
GraphQLResolver/graphqlBearer tokenGraphQL query execution. Extends RESTResolver — supports GET and POST. Validates schema, parses AST, executes with auth context
GraphiQLLoader/graphiqlNoServes the GraphiQL interactive IDE for exploring the GraphQL API

Authentication Resolvers​

ResolverURL PatternAuthPurpose
AuthenticationResolver/authenticateOAuth2 ticketOAuth2 callback handler. Validates ticket with provider, sets token in Set-Cookie header, redirects to hub-gui
NotAuthorizedResolver(error handler)—Returns 401 response for unauthorized requests
Http403ForbiddenResolver(error handler)—Returns 403 response for forbidden requests

File Resolvers​

ResolverURL PatternAuthPurpose
FileUploadResolver/Upload/{type}/{clientId}YesChunked file upload processing. Supports multiple files, binary format, max 25 MB. Returns postMessage JSON for iframe context
FileRequestResolver/Download/{fileId}, /Configuration/{appName}/{configName}[/{version}], /Update/{appName}[/{releaseName}[/{platform}[/{version}]]]OptionalFile, configuration and self-update package download with proper MIME types and range request support. Without a version, /Update/... serves the latest registered package; private packages require a Bearer token with access to them
UpdateChecksumResolver/UpdateChecksum/{appName}/{releaseName}/{platform}[/{version}]OptionalJSON {name, version, sha256} of exactly the package the same /Update/... arguments download (same version selection and access rules). The hash is cached per package file. Agents read it first and then download the returned version explicitly, so a package registered in between cannot be checked against another package's hash
ImageRequestResolver/image/...VariesImage serving with caching headers

Agent & Monitoring Resolvers​

ResolverURL PatternAuthPurpose
ForwardingResolver/forward, /forward/continueAgent tokenWebSocket reverse tunneling for agents. See Request Forwarding
AgentStatusResolver/agent-statusYesAgent health and status monitoring
PingResolver/pingNoHealth check endpoint — returns simple acknowledgment
LiveContentResolver/live/...YesServer-sent events for real-time content updates

Content & Plugin Resolvers​

ResolverURL PatternAuthPurpose
FrontEndLoader/ (fallback)NoServes the hub-gui SPA bundle (HTML, JS, CSS)
PluginsRepository/plugins/...YesPlugin management and serving
Http404NotFoundResolver(fallback)—Returns 404 response for unmatched URLs

RESTResolver Details​

The REST API uses Bearer token authentication with a fallback to service account credentials:

GET /api/users HTTP/1.1
Authorization: Bearer <token>

The accessValidator() flow:

  1. Extract Bearer token from Authorization header
  2. Validate token via AuthManager.IsAuthenticated()
  3. If token is invalid, attempt service account authentication via AuthManager.Authenticate()
  4. If both fail, return 401

URL patterns support up to 6 nested segments: /api/{section}/{sub1}/{sub2}/{sub3}/{sub4}/{sub5}.

GraphQLResolver Details​

Extends RESTResolver to inherit its authentication. The resolver:

  1. Validates the GraphQL schema structure
  2. Parses the query string into an AST
  3. Validates the AST against the schema
  4. Executes with an auth-aware context — every field resolution is wrapped in AuthManager.IsAuthorizedFor()
  5. Returns results via GraphQLResponse formatter

Supports both GET (query parameter) and POST (request body) methods.


See also: HTTP Processing Pipeline | Request Forwarding | GraphQL API | Hub Backend Overview