MiniServer
BoxLang includes a lightning fast web server powered by Undertow!

The BoxLang MiniServer runtime is a lightweight, lightning-fast web server powered by Undertow. It's ideal for fast applications, desktop apps (Electron/JavaFX), embedded web servers, and development. For those who desire a more robust and feature-rich servlet server implementation, we offer our open-source FREE CommandBox server and CommandBox PRO with a BoxLang Subscription.
Tip: Please note that the BoxLang MiniServer is NOT a servlet server. There is no servlet container; the web server is just a simple, fast, and pure Java Undertow server.
CommandBox is our open-source servlet server implementation. However, with a Boxlang +/++ subscription, it becomes a powerhouse for mission-critical applications. Check out all that you get with CommandBox Pro: https://www.ortussolutions.com/products/commandbox-pro
📋 Table of Contents
▶️ Start a Server
The BoxLang core OS runtime doesn't know about a web application. Our web support runtime provides this functionality, a crucial part of the MiniServer and the Servlet (JEE, Jakarta, CommandBox) runtime. This runtime enhances the core boxlang runtime, making it multi-runtime and web deployable.
If you use our Windows installer or our Quick Installer, you will have the boxlang-miniserver binary installed in your operating system. You will use this to start servers. Just navigate to any folder that you want to start a server in and run boxlang-miniserver.
Please note that our VSCode BoxLang Extension can also assist you in managing and starting/stopping servers.
Once you run the command, the following output will appear in your console:
As you can see from the output, this is the result of the command:
Use the current working directory as the web root.
Bind to
0.0.0.0:8080by default (accessible from any network interface)Automatic .env file loading - Environment variables from
.envfiles in the webroot are loaded into system propertiesBuilt-in security protection - Blocks access to hidden files and directories (starting with
.) for securityWebSocket support enabled by default at
/wsendpointThis configures the web server with some default welcome files and no rewrites.
BoxLang will process any BoxLang or CFML files
Uses the user's BoxLang home as the default for configuration and modules:
~/.boxlang
ALERT: The BoxLang Core knows nothing of web or HTTP, so the form, url, cookie, and cgi scopes will only exist when running the BoxLang web server (but not in the REPL, etc).
That's practically it. This is a very lightweight server that can get the job done. You can also start up servers using our VSCode IDE by opening the command palette and clicking Start a BoxLang web server.


📋 JSON Configuration
The BoxLang MiniServer supports loading configuration from a JSON file. This allows you to store all server settings in one place instead of passing them as command-line arguments every time.
Automatic Loading
If you run boxlang-miniserver with no arguments, it will automatically look for a miniserver.json file in the current directory:
Explicit Path
You can also specify the path to a JSON configuration file:
Override with CLI
Command-line arguments always override JSON configuration:
Configuration Options
All the following options are supported in the JSON configuration file:
port
number
8080
The port to listen on
host
string
"0.0.0.0"
The host to bind to
webRoot
string
current directory
Path to the webroot directory
debug
boolean
false
Enable debug mode
configPath
string
null
Path to BoxLang configuration file
serverHome
string
null
BoxLang server home directory
rewrites
boolean
false
Enable URL rewrites
rewriteFileName
string
"index.bxm"
Rewrite target file
healthCheck
boolean
false
Enable health check endpoints
healthCheckSecure
boolean
false
Restrict detailed health info to localhost only
envFile
string
null
Path to custom environment file (relative or absolute)
Example Configuration Files
Basic Configuration
Development Configuration
Production Configuration
Complete Configuration
Configuration Priority
Configuration values are loaded in the following order (later sources override earlier ones):
Default values - Built-in defaults
Environment variables -
BOXLANG_*environment variablesJSON configuration - Values from the JSON file
Command-line arguments - Explicit CLI flags
For example, if you have:
Environment variable:
BOXLANG_PORT=3000JSON file:
"port": 8080CLI argument:
--port 9090
The server will start on port 9090 (CLI overrides all).
Configuration Notes
The JSON file must be valid JSON (no comments allowed in the actual file)
All fields are optional - you only need to specify the ones you want to change
Null values in the JSON file will be treated as "not set"
Boolean values must be lowercase (
trueorfalse)String paths can be relative or absolute
Environment File Loading
The envFile option allows you to specify a custom environment file to load instead of the default .env file in the webroot:
If
envFileis not specified, the server looks for.envin the webroot directory (default behavior)If
envFileis specified, it loads that file insteadThe path can be relative (resolved from current directory) or absolute
Environment variables are loaded as system properties and can be used throughout the application
Example:
or
🔧 Arguments
These are the supported arguments you can pass into the binary to configure the server.
--configPath path/boxlang.json
-c path/boxlang.json
Relative/Absolute location of the boxlang.json to use. By default it uses the ~/.boxlang/boxlang.json
--debug
-d
Put the runtime into debug mode. This will also render detailed error messages in the browser. By default we use false
--help
-h
Display comprehensive help information and exit
--host ip|domain
Bind the hostname to the mini server. By default we use 0.0.0.0 (all network interfaces)
--port 8080
-p 8080
The port to bind the mini server to. By default we use port 8080
--rewrites [index.bxm]
-r [index.bxm]
Enable rewrites for applications using index.bxm as the file to use. You can also pass the name of the file to use: --rewrites myfile.bxm
--health-check
Enable health check endpoints at /health, /health/ready, and /health/live. These provide detailed server status, readiness, and liveness information in JSON format.
--health-check-secure
Restrict detailed health check information to localhost only. When enabled, non-localhost requests receive basic status only, while localhost gets full system details including JVM metrics and memory usage.
--serverHome path/
-s path/
The location of the BoxLang home for the miniserver. This is where it will look for the boxlang.json, place to put the log files, the compiled classes, load modules, and much more.
By default, we use the OS home via the BOXLANG_HOME environment variable which usually points to the user's home: ~/.boxlang/
--version
-v
Display version information and exit
--webroot path/
-w path/
The webserver root. By default, we use the directory from where you started the command.
🛡️Environment Variables
The boxlang-miniserver binary will also scan for several environment variables as overrides to the execution process.
BOXLANG_CONFIG = PATH
Override the boxlang.json
BOXLANG_DEBUG = boolean
Enable or disable debug mode
BOXLANG_HOME = directory
Override the server HOME directory
BOXLANG_HOST = ip or domain
Override the 0.0.0.0 default to whatever IP or domain you like.
BOXLANG_PORT = 8080
Override the default port
BOXLANG_REWRITES = boolean
Enable or disable URL rewrites
BOXLANG_REWRITE_FILE = file.bxm
Choose the rewrite file to use. By default, it uses index.bxm
BOXLANG_WEBROOT = path
Override the location of the web root
BOXLANG_HEALTH_CHECK = boolean
Enable or disable health check endpoints
BOXLANG_HEALTH_CHECK_SECURE = boolean
Enable secure health checks (detailed info only on localhost)
BOXLANG_MINISERVER_OPTS = jvmOptions
A list of Java options to pass to the startup command
Environment variables are scanned first, then the command arguments. Thus, the command arguments take precedence.
🔒 Security Features
The BoxLang MiniServer includes built-in security features to protect your applications:
Hidden File Protection
The server automatically blocks access to hidden files and directories (those starting with a dot .). This security feature protects sensitive files such as:
.envfiles containing environment variables.gitdirectories and configuration.htaccessand other web server configuration filesAny custom hidden files or directories
When a request is made for a hidden file, the server returns a 404 Not Found response for security reasons, without revealing whether the file actually exists.
🩺 Health Check Endpoints
The MiniServer provides comprehensive health monitoring capabilities through dedicated endpoints:
Basic Health Checks
Enable health checks with the --health-check flag:
This enables three endpoints:
/health- Complete health information including system metrics, JVM details, and runtime status/health/ready- Readiness probe for load balancers (simple UP/DOWN status)/health/live- Liveness probe for container orchestration (simple UP/DOWN status)
Secure Health Checks
For production environments, use the --health-check-secure flag:
When secure mode is enabled:
Localhost requests receive full detailed health information
Remote requests receive only basic status information
This prevents sensitive system information from being exposed to external networks
Health Check Response Format
The /health endpoint returns comprehensive JSON information:
The health check provides:
Status - Current server status (UP/DOWN)
Timestamp - Current server time in ISO format
Uptime - Human-readable server uptime
UptimeMs - Server uptime in milliseconds
Version - BoxLang version information
Build Date - When BoxLang was built
Java Version - JVM version information
Memory Usage - Current memory usage in bytes
Memory Max - Maximum available memory in bytes
🌍 Environment Files
The MiniServer automatically loads environment variables from .env files located in your webroot directory:
Automatic .env Loading
When you start the server, it will automatically look for and load a .env file in the webroot:
.env File Format
Your .env file should contain key-value pairs:
Accessing Loaded Variables
Environment variables loaded from .env files are:
Added to Java System Properties - Accessible via
System.getProperty("key")Available in BoxLang - Accessible through the
server.system.propertiesstructAvailable to your applications - Can be used in BoxLang code for configuration
It is important to note that these variables will not exist as "proper" environment variables due to how BoxLang's runtime loads. The structure, server.system.environment, contains system level environment variables and will not reflect the values set in your .env file. Using server.system.properties would work locally, but not in production, as the value would most likely instead be in the environment structure. Luckily, BoxLang provides a simple BIF that can work with either, getSystemSetting(). Given the example .env file above, using getSystemSetting("API_KEY") would work both locally using the value loaded from the file and in production using a value loaded as an environment variable.
🔌 WebSocket Support
The BoxLang MiniServer includes built-in WebSocket support for real-time communication:
WebSocket Endpoint
WebSocket connections are available at the /ws endpoint:
SocketBox - BoxLang WebSocket Library
For enhanced WebSocket functionality in your BoxLang applications, we recommend using SocketBox - our companion library specifically designed for BoxLang WebSocket development:
SocketBox is available on ForgeBox: https://forgebox.io/view/socketbox
SocketBox provides:
High-level WebSocket abstractions for BoxLang applications
Event-driven architecture with listeners and handlers
Room and namespace management for organizing connections
Built-in authentication and authorization support
Message broadcasting to multiple clients
Connection lifecycle management with automatic reconnection
Integration with BoxLang frameworks like ColdBox
Installing SocketBox
SocketBox Example
WebSocket Features
Real-time bidirectional communication between client and server
Automatic connection management with built-in error handling
STOMP protocol support with proper heartbeat responses for connection reliability
Integration with BoxLang runtime for server-side message processing
Low latency communication for interactive applications
Enhanced functionality with SocketBox library for production applications
The WebSocket server is automatically started when the MiniServer launches, as indicated by the console message:
🏠 Default Welcome Files
The BoxLang MiniServer automatically serves welcome files when a request is made to a directory. The server looks for these files in the following order:
index.bxm- BoxLang Markup (preferred)index.bxs- BoxLang Scriptindex.cfm- CFML Markup (legacy compatibility)index.cfs- CFML Script (legacy compatibility)index.htm- HTMLindex.html- HTML
Welcome File Behavior
When a request is made to a directory (e.g., http://localhost:8080/), the server will:
Check for welcome files in the order listed above
Serve the first match found in the directory
Enable directory listing if no welcome file is found (showing folder contents)
Process BoxLang/CFML files through the runtime before serving
Serve static files (HTML) directly without processing
Example Directory Structure
Tip: Use index.bxm for your main pages to take advantage of BoxLang's modern syntax and features while maintaining compatibility with legacy CFML files.
🔀 URL Rewrites
The BoxLang MiniServer supports URL rewrites for creating clean, SEO-friendly URLs and building single-page applications (SPAs):
Enabling URL Rewrites
Enable URL rewrites with the --rewrites flag:
How URL Rewrites Work
When URL rewrites are enabled:
Any request that does not match an asset will route through your specified rewrite file (default:
index.bxm)This includes requests to JavaScript, CSS, images and BXM, BXS, or BX files.
URL Rewrite Examples
Use Cases for URL Rewrites
Single Page Applications (SPAs) - Route all requests to your main app file
Clean URLs -
/products/123instead of/product.bxm?id=123Custom routing - Implement your own URL routing logic
Framework applications - Perfect for ColdBox, FW/1, or custom frameworks
Console Output
When rewrites are enabled, you'll see:
🛑 Server Management
Graceful Shutdown
The BoxLang MiniServer supports graceful shutdown for safe server termination:
When you stop the server, you'll see:
The graceful shutdown process:
Stops accepting new requests immediately
Completes active requests before shutting down
Closes the BoxLang runtime properly
Releases all resources (ports, file handles, etc.)
Background Execution
For production deployments, you can run the server in the background:
Production Note: For production deployments, consider using process managers like systemd, supervisor, or Docker containers for better service management and automatic restarts.
⚡ Performance Features
The BoxLang MiniServer includes several built-in performance optimizations:
Automatic GZIP Compression
The server automatically compresses responses using GZIP compression for better performance:
Automatic compression for responses larger than 1.5KB
Smart content detection - only compresses suitable content types
Client support detection - only compresses when client supports it
Bandwidth savings - typically 60-80% reduction in transfer size
Performance Characteristics
Fast startup times - typically under 1 second
Low memory footprint - minimal overhead beyond your application
High concurrency - built on Undertow's high-performance architecture
Zero-copy static file serving - optimized static asset delivery
Keep-alive connections - reduces connection overhead
Performance Tips
Performance Tip: The MiniServer is optimized for development and light production workloads. For high-traffic applications, consider using CommandBox with load balancing and clustering capabilities.
Using 3rd Party Jars
You can load up custom third-party JARs into the runtime in two ways
BOXLANG_HOME/lib- You can place all the jars that the runtime will load in this locationRemember, you can use the
--serverHometo choose the location of the server's home
Add via the classpath to your runner.
Please note that if you use the -cp approach, then you need to use a full java -cp syntax or you can customize the boxlang-miniserver shell scripts to do your bidding.
If you want to test 3rd part libs with the web server, you’ll need to use a different syntax that uses the -cp (classpath) JVM arg and specifies both the boxlang jar AND a semicolon-delimited list of the jars you want to use. It’s a little annoying, but this is how Java works.
Modules
The MiniServer can use any module you install into the OS home via the install-bx-module binary. However, if you choose your own server home using the server-home argument or the environment variable. Then, place the modules inside a modules directory inside the server's home.
JVM Options
You can use the BOXLANG_MINISERVER_OPTS env variable to seed the Java arguments the miniserver will start with.
Runtime Source Code
The runtime source code can be found here: https://github.com/ortus-boxlang/boxlang-miniserver
We welcome any pull requests, testing, docs, etc.
🌐 Reverse Proxy Setup
For production deployments, it's recommended to place a reverse proxy in front of the BoxLang MiniServer. This provides additional security, SSL termination, load balancing, and better static file serving capabilities.
🔧 Nginx Configuration
Nginx is a popular choice for reverse proxying BoxLang applications:
Basic Nginx Configuration
Load Balancing with Multiple MiniServers
🔥 Apache Configuration
Apache HTTP Server with mod_proxy for reverse proxying:
Basic Apache Configuration
Required Apache Modules
🪟 IIS Configuration
Internet Information Services (IIS) configuration using Application Request Routing (ARR):
Prerequisites
Install Application Request Routing (ARR) module
Install URL Rewrite module
IIS Configuration Steps
Create a new website in IIS Manager
Configure ARR at the server level:
Site-Level web.config
🚀 Production Setup Recommendations
1. Configure MiniServer for Production
2. System Service Setup
Create a systemd service for automatic startup:
3. Security Considerations
Bind to localhost only when behind a reverse proxy
Enable health check security to restrict detailed information
Use HTTPS at the reverse proxy level
Configure proper security headers in your reverse proxy
Restrict health check endpoints to internal networks if needed
Regular security updates for your reverse proxy software
4. Monitoring and Logging
Access logs at the reverse proxy level
Health check monitoring using
/health/readyand/health/livePerformance monitoring through reverse proxy metrics
Log aggregation for centralized monitoring
Production Tip: Using a reverse proxy provides additional benefits like SSL termination, static file serving, request compression, security headers, and load balancing capabilities that complement the BoxLang MiniServer's performance.
Last updated
Was this helpful?
