Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::RestServerConfig Struct Reference

Configuration parameters for the REST API server. More...

#include <mitkRestServerConfig.h>

Collaboration diagram for mitk::RestServerConfig:

Public Attributes

std::string host
 IP address or hostname to bind to. More...
 
int port
 TCP port to listen on. More...
 
bool enabled
 Whether the server should be started automatically. More...
 
int threadPoolSize
 Number of worker threads for handling requests. More...
 
int readTimeoutSeconds
 Socket read timeout in seconds. More...
 
int writeTimeoutSeconds
 Socket write timeout in seconds. More...
 
ClientAccessMode clientAccessMode
 Client IP access control mode. More...
 
std::vector< std::string > allowedClientIPs
 List of allowed client IPs (used with Whitelist mode). More...
 
bool requireAuth
 If true, require Bearer token authentication. More...
 
std::string apiToken
 The expected API token for Bearer authentication. More...
 
int maxPayloadSizeMB
 Maximum request payload size in megabytes. More...
 
FileAccessMode fileAccessMode
 File system access restriction mode. More...
 
std::vector< std::string > allowedFileDirectories
 Allowed directories (used with AllowedDirectories mode). More...
 
bool rateLimitEnabled
 If true, enable per-IP rate limiting. More...
 
int rateLimitPerMinute
 Maximum number of requests per IP per minute. More...
 
size_t maxActiveTempDirsPerIp
 Maximum number of active temporary directories per client IP. More...
 
bool httpsEnabled
 If true, enable HTTPS with TLS. More...
 
std::string sslCertPath
 Path to the SSL/TLS certificate file. More...
 
std::string sslKeyPath
 Path to the SSL/TLS private key file. More...
 

Detailed Description

Configuration parameters for the REST API server.

This struct holds all configurable settings for the MITK REST API server, including network binding, security, rate limiting, and file access controls. A RestServerConfig instance represents the "pending" configuration that takes effect on the next server start.

See also
IRestServerService, RestServer

Definition at line 55 of file mitkRestServerConfig.h.

Member Data Documentation

◆ allowedClientIPs

std::vector<std::string> mitk::RestServerConfig::allowedClientIPs

List of allowed client IPs (used with Whitelist mode).

Definition at line 82 of file mitkRestServerConfig.h.

◆ allowedFileDirectories

std::vector<std::string> mitk::RestServerConfig::allowedFileDirectories

Allowed directories (used with AllowedDirectories mode).

Definition at line 90 of file mitkRestServerConfig.h.

◆ apiToken

std::string mitk::RestServerConfig::apiToken

The expected API token for Bearer authentication.

Definition at line 85 of file mitkRestServerConfig.h.

◆ clientAccessMode

ClientAccessMode mitk::RestServerConfig::clientAccessMode

Client IP access control mode.

Definition at line 81 of file mitkRestServerConfig.h.

◆ enabled

bool mitk::RestServerConfig::enabled

Whether the server should be started automatically.

Definition at line 76 of file mitkRestServerConfig.h.

◆ fileAccessMode

FileAccessMode mitk::RestServerConfig::fileAccessMode

File system access restriction mode.

Definition at line 89 of file mitkRestServerConfig.h.

◆ host

std::string mitk::RestServerConfig::host

IP address or hostname to bind to.

Defaults to the IPv6 wildcard address "::" so the server accepts both IPv6 and IPv4 (4-mapped) connections from a single socket. This avoids the ~2 s IPv6-first / IPv4-fallback latency that Windows clients otherwise pay when resolving localhost (which Windows orders as [::1, 127.0.0.1]).

cpp-httplib is built with CPPHTTPLIB_IPV6_V6ONLY=false, so it explicitly clears IPV6_V6ONLY on the listening socket; this is required for dual-stack on Windows where the OS default would otherwise be v6-only.

Set to "127.0.0.1" to pin the server to IPv4 loopback only, to a specific interface address, or to "0.0.0.0" for the IPv4 wildcard.

Definition at line 74 of file mitkRestServerConfig.h.

◆ httpsEnabled

bool mitk::RestServerConfig::httpsEnabled

If true, enable HTTPS with TLS.

Definition at line 97 of file mitkRestServerConfig.h.

◆ maxActiveTempDirsPerIp

size_t mitk::RestServerConfig::maxActiveTempDirsPerIp

Maximum number of active temporary directories per client IP.

Definition at line 95 of file mitkRestServerConfig.h.

◆ maxPayloadSizeMB

int mitk::RestServerConfig::maxPayloadSizeMB

Maximum request payload size in megabytes.

Definition at line 87 of file mitkRestServerConfig.h.

◆ port

int mitk::RestServerConfig::port

TCP port to listen on.

Definition at line 75 of file mitkRestServerConfig.h.

◆ rateLimitEnabled

bool mitk::RestServerConfig::rateLimitEnabled

If true, enable per-IP rate limiting.

Definition at line 92 of file mitkRestServerConfig.h.

◆ rateLimitPerMinute

int mitk::RestServerConfig::rateLimitPerMinute

Maximum number of requests per IP per minute.

Definition at line 93 of file mitkRestServerConfig.h.

◆ readTimeoutSeconds

int mitk::RestServerConfig::readTimeoutSeconds

Socket read timeout in seconds.

Definition at line 78 of file mitkRestServerConfig.h.

◆ requireAuth

bool mitk::RestServerConfig::requireAuth

If true, require Bearer token authentication.

Definition at line 84 of file mitkRestServerConfig.h.

◆ sslCertPath

std::string mitk::RestServerConfig::sslCertPath

Path to the SSL/TLS certificate file.

Definition at line 98 of file mitkRestServerConfig.h.

◆ sslKeyPath

std::string mitk::RestServerConfig::sslKeyPath

Path to the SSL/TLS private key file.

Definition at line 99 of file mitkRestServerConfig.h.

◆ threadPoolSize

int mitk::RestServerConfig::threadPoolSize

Number of worker threads for handling requests.

Definition at line 77 of file mitkRestServerConfig.h.

◆ writeTimeoutSeconds

int mitk::RestServerConfig::writeTimeoutSeconds

Socket write timeout in seconds.

Definition at line 79 of file mitkRestServerConfig.h.


The documentation for this struct was generated from the following file: