Skip to content

Static Folders

Static folder ingress rules serve files directly from a folder in the virtual filesystem — no script execution required. Use this for HTML pages, CSS, images, JavaScript bundles, and other static assets.

How It Works

  1. An ingress rule with type STATIC_FOLDER maps a URL prefix to a folder in the virtual filesystem
  2. When a request arrives, the engine resolves the relative path after the route prefix
  3. It walks the virtual filesystem tree to find the matching file
  4. The file is served with a Content-Type guessed from the filename
  5. Directory requests serve index.html automatically

Key Differences from Script Ingress

AspectHTTP IngressStatic Folder
scriptUUID points toA script fileA folder tree item
ExecutionScript runs per requestNo script — file served directly
Content-TypeSet by Results chainAuto-detected from filename
Index behaviorN/AServes index.html for directory URLs

Route Mapping

Given a static folder ingress with route /site pointing to a folder containing:

/my-website/
  index.html
  styles.css
  app.js
  images/
    logo.png

The following URLs are served:

URLFile served
/backend/siteindex.html
/backend/site/index.html
/backend/site/styles.cssstyles.css
/backend/site/app.jsapp.js
/backend/site/images/logo.pngimages/logo.png

The /http_root Route

The special route /http_root maps to the web server root (/). This is useful for serving a full website at the root URL:

Ingress: STATIC_FOLDER, route = /http_root
Folder:  /public-website/

/public-website/index.html  →  http://your-host/
/public-website/about.html  →  http://your-host/about.html
/public-website/css/main.css → http://your-host/css/main.css

Content-Type Detection

Content types are guessed from the file extension using Java's URLConnection.guessContentTypeFromName(). Common mappings:

ExtensionContent-Type
.htmltext/html
.csstext/css
.jsapplication/javascript
.jsonapplication/json
.pngimage/png
.jpg / .jpegimage/jpeg
.svgimage/svg+xml
.pdfapplication/pdf
.txttext/plain

Use Cases

Single-Page Application

Serve a built SPA (React, Vue, etc.) by pointing a static folder at the build output:

/spa-app/
  index.html
  assets/
    main.js
    style.css

Marketing Site

Serve a static marketing site alongside your API endpoints:

Static folder ingress: /http_root → /marketing-site/
HTTP GET ingress:      /api/contact → /ingresses/api/contact-form.js

Documentation

Host generated documentation (e.g., from a static site generator):

Static folder ingress: /docs → /documentation/

TIP

Static folders are the simplest way to serve frontend assets. They require no JavaScript handler code and are served directly from the virtual filesystem.

DieselEngine Scripting Documentation