IR
irwinrodriguez.dev
Back to docs

Configuration

Each server is a JSON file (its manifest) in config\servers\. It is created by foxserver init and updated by the hook at compile time; you can also edit it by hand, and FoxForge edits it with forms from the VFP IDE.

Configuration file location

Each project has its own file at:

C:\Program Files\FoxServer\config\servers\{projectname}.json

Complete example

A complete server manifest
{
  "name": "almacen",
  "description": "API de almacen",
  "type": "api",
  "active": true,
  "host": "127.0.0.1",
  "port": 8099,
  "prefix": "",
  "issecure": false,
  "certificatename": "",
  "certificatepassword": "",
  "dllpath": "C:\\proyectos\\almacen\\build\\almacen.dll",
  "allowedorigins": "https://miapp.com",
  "allowedmethods": "GET,POST,PUT,DELETE,OPTIONS",
  "allowedheaders": "Content-Type,Authorization",
  "lifecycle": {
    "enabled": true,
    "classname": "MiErpLifecycleClass"
  },
  "hotreload": {
    "enabled": false,
    "debouncems": 1500,
    "maxretries": 3
  },
  "server": {
    "checkstatusenabled": true,
    "endpoint": "server/status"
  },
  "middleware": {
    "auth": {
      "enabled": true,
      "type": "jwt",
      "secret": "",
      "tokenexpirationseconds": 3600,
      "loginendpoint": "auth/login"
    },
    "logging": {
      "enabled": true,
      "path": "C:\\proyectos\\almacen\\logs\\",
      "fileprefix": "almacen",
      "format": "Detailed",
      "options": {
        "requests": true,
        "responses": true,
        "errors": true,
        "debug": false,
        "performance": true
      }
    }
  }
}
The JWT secret is EMPTY in this example on purpose, and so is the certificate: a sample manifest with something that looks like a key ends up copied verbatim into production. The manifest lives in config\servers\ next to the license (config\foxserver.lic), so treat that folder for what it is: secrets.

Server properties

PropertyTypeDefaultDescription
name String — Unique project/server identifier
description String "" Human-readable description
type String api "api" for REST APIs, "web" for serving static files
active Boolean false Whether the server loads on FoxServer startup
host String 127.0.0.1 Bind address. 0.0.0.0 accepts all interfaces
port Number 8080 HTTP listening port
prefix String "" URL path prefix (e.g. "/api/v1")
issecure Boolean false Enable HTTPS/SSL
dllpath String — Path to the project's compiled MTDLL (required). Since 0.9 the engine activates by ProgID, so this path points at the native VFP DLL, not at a .NET assembly
publicdir String "" Static files directory (type: web only)

CORS

Configure allowed origins, methods and headers for cross-domain requests:

{
  "allowedorigins": "https://app.example.com,https://admin.example.com",
  "allowedmethods": "GET,POST,PUT,DELETE,OPTIONS",
  "allowedheaders": "Content-Type,Authorization,X-Requested-With"
}
PropertyTypeDefaultDescription
allowedoriginsString*Allowed domains separated by comma, or "*" for any
allowedmethodsStringGET,POST,PUT,DELETE,OPTIONSHTTP methods allowed from the browser
allowedheadersStringContent-Type,AuthorizationHeaders the client can send
In production, always specify exact domains instead of "*" for better security.

HTTPS / SSL

To enable HTTPS you need a certificate in .pfx or .p12 format:

{
  "issecure": true,
  "certificatename": "mycert.pfx",
  "certificatepassword": "your-cert-password"
}
Never include certificate passwords in version control. Use environment variables or a secret manager.

Redirects (web sites)

Since 0.9.36 a site of type web can answer that something lives at another URL. The rules go in the redirects list of the manifest, and the server checks them before looking for the file on disk. A rule takes precedence over whatever is in publicdir, so it also works to retire the URL of a file that is still there, such as the installer of an old version.

{
  "type": "web",
  "redirects": [
    {
      "from": "/kit/FoxAgent-Setup-1.63.2.exe",
      "to": "/kit/retired/",
      "status": 302
    },
    {
      "from": "/old-docs/",
      "to": "/docs/",
      "status": 301,
      "match": "prefix"
    }
  ],
  "trailingslashredirect": true
}
PropertyTypeDefaultDescription
fromString(required)Path the client asks for, starting with /. It is compared with the whole path (server prefix included), decoded and case-insensitive.
toString(required)Target: a path on the same site or an absolute URL (https://...).
statusNumber302301 and 308 are permanent and the browser remembers them. 302 and 307 are temporary and are sent with Cache-Control: no-store.
matchStringexactexact matches the whole path. prefix matches everything that starts with from and appends the rest to to: /old-docs/a/b goes to /docs/a/b.
  • The first rule that matches wins, in the order of the file.
  • The query string of the request travels to the target, unless to has its own.
  • The response carries Location and a minimal HTML page with the link, for clients that do not follow redirects. A HEAD request gets the headers only.
  • A badly written rule is skipped at startup, with a log warning that says which one and why: from without the leading slash, an empty to, a status outside the list, an unknown match or an obvious loop (a prefix rule whose to starts with its own from). The server starts anyway and the other rules keep working.
  • Only a site of type web applies them. A server that serves REST dispatches through the API and ignores them; foxserver validate warns about it.
  • The server reads the rules when it starts. Restart it after changing them.

The trailing slash of folders

With "trailingslashredirect": true, a folder requested without its trailing slash (/docs/guide) answers 301 to the same path with the slash (/docs/guide/) and keeps the query string, as nginx, Apache or IIS do. Each page then lives at a single URL and its relative links point at the right folder. It is off by default because it changes what an already published site answers, and that is up to whoever publishes it.

From the command line

foxserver redirect-add --project C:\proyectos\web --from /kit/FoxAgent-Setup-1.63.2.exe --to /kit/retired/
foxserver redirect-add --project C:\proyectos\web --from /old-docs/ --to /docs/ --status 301 --match prefix
foxserver redirect-list --project C:\proyectos\web
foxserver redirect-remove --project C:\proyectos\web --from /old-docs/
foxserver redirect-trailing-slash --project C:\proyectos\web on

These commands edit the project manifest (build\) and reach the server with foxserver deploy, like the rest of the configuration. A redirect-add with a from that already exists replaces that rule in place. Saving the project from FoxForge or from the CLI keeps rules written by hand, including fields the tool does not know.

Logging

Configure the server logging system:

PropertyTypeDefaultDescription
enabledBooleanfalseEnable / disable logging
pathString—Directory where log files are written (must exist)
fileprefixStringfoxserverFile name prefix. Result: "{prefix}_2026-04-11.log"
formatStringSimple"Simple" (one line), "Detailed" (full info), "JSON"
options.requestsBooleantrueLog incoming requests
options.responsesBooleantrueLog outgoing responses
options.errorsBooleantrueLog errors
options.debugBooleanfalseLog debug messages (more verbose)
options.performanceBooleanfalseLog response times per endpoint

Next: Routing →