Skip to content

Connect FMMatchLens over LAN with Caddy

osnsyc edited this page Sep 30, 2026 · 1 revision

FMMatchLens can be accessed from another device on the same local network by using Caddy as a lightweight reverse proxy and static file server.

With this setup, Caddy will:

  • Serve the built FMMatchLens Dashboard
  • Forward /api/* requests to the FMMatchLens backend
  • Forward WebSocket connections
  • Expose the Dashboard and backend through a single LAN address

Architecture

Another device on the LAN
        │
        │  http://192.168.x.x:16727
        ▼
      Caddy
        │
        ├── /            → Dashboard files
        │
        ├── /api/*       → 127.0.0.1:16726
        │
        └── /ws*         → 127.0.0.1:16726
                              │
                              ▼
                    FMMatchLens Backend

The FMMatchLens backend itself can continue listening only on:

127.0.0.1:16726

Caddy acts as the LAN-facing entry point.


1. Download Caddy

Download Caddy from the official website:

https://caddyserver.com/download

Place caddy.exe in a directory together with the Dashboard build.

For example:

FMMatchLens-LAN/
├── caddy.exe
├── Caddyfile
└── dist/
    ├── index.html
    ├── assets/
    └── ...

The dist directory should contain the production build of the FMMatchLens Dashboard.


2. Create the Caddyfile

Create a file named:

Caddyfile

with the following configuration:

http://:16727 {
    root * ./dist

    handle /api/* {
        reverse_proxy 127.0.0.1:16726
    }

    handle /ws* {
        reverse_proxy 127.0.0.1:16726
    }

    handle {
        try_files {path} /index.html
        file_server
    }
}

What this configuration does

root * ./dist

Serves the FMMatchLens Dashboard from the local dist directory.

handle /api/*

Forwards all API requests to the FMMatchLens backend:

http://192.168.x.x:16727/api/...

becomes:

http://127.0.0.1:16726/api/...

handle /ws*

Forwards WebSocket connections to the FMMatchLens backend.

Caddy supports WebSocket proxying automatically, so no additional WebSocket configuration is required.

try_files {path} /index.html

Provides SPA fallback for the Dashboard.

This allows routes such as:

/match
/analysis
/settings

to work correctly when opened or refreshed directly.


3. Start FMMatchLens

Start Football Manager and make sure the FMMatchLens plugin is running.

You can verify the backend locally by opening:

http://127.0.0.1:16726/api/match/status

If the backend is working, it should return the current FMMatchLens status.


4. Validate the Caddy configuration

Open PowerShell in the directory containing caddy.exe and Caddyfile.

Run:

.\caddy.exe validate --config .\Caddyfile

If the configuration is valid, Caddy should report that the configuration is valid.


5. Start Caddy

Run:

.\caddy.exe run --config .\Caddyfile

Caddy will now listen on:

http://0.0.0.0:16727

You can test it locally:

http://127.0.0.1:16727

The FMMatchLens Dashboard should load.

You can also test the proxied API:

http://127.0.0.1:16727/api/match/status

6. Find your LAN IP address

On Windows, run:

ipconfig

Find the IPv4 address of the network adapter currently connected to your LAN.

For example:

IPv4 Address . . . . . . . . . . : 192.168.1.100

Your FMMatchLens Dashboard will then be available at:

http://192.168.1.100:16727

Open this address on another computer, tablet, or phone connected to the same network.


7. (Optional) Allow Caddy through Windows Firewall

If the Dashboard works on the host computer but cannot be accessed from another device, Windows Firewall is likely blocking incoming connections.

Open PowerShell as Administrator and run:

New-NetFirewallRule `
  -DisplayName "FMMatchLens Caddy LAN" `
  -Direction Inbound `
  -Protocol TCP `
  -LocalPort 16727 `
  -Action Allow `
  -Profile Private

This allows TCP port 16727 on Private networks.

For additional security, you can restrict access to your local subnet.

For example:

New-NetFirewallRule `
  -DisplayName "FMMatchLens Caddy LAN" `
  -Direction Inbound `
  -Protocol TCP `
  -LocalPort 16727 `
  -RemoteAddress 192.168.1.0/24 `
  -Action Allow `
  -Profile Private

Adjust the subnet according to your local network.


8. Dashboard backend configuration

For example:

Dashboard
http://192.168.1.100:16727

Troubleshooting

Dashboard works locally but not on another device

Check:

  • Both devices are connected to the same local network
  • The host PC is using a Private network profile
  • TCP port 16727 is allowed through Windows Firewall
  • Caddy is still running
  • You are using the correct LAN IP address

You can verify that Caddy is listening with:

netstat -ano | findstr :16727

You should see a listening entry for port 16727.


Dashboard loads but API requests fail

First check the FMMatchLens backend directly:

http://127.0.0.1:16726/api/match/status

Then check the same endpoint through Caddy:

http://127.0.0.1:16727/api/match/status

If the first works but the second does not, check the Caddy console output.


API works but live match data does not update

This may indicate a WebSocket connection problem.

Check the browser Developer Tools:

Network → WS

The WebSocket URL should use the Caddy address, for example:

ws://192.168.1.100:16727/ws

rather than connecting directly to:

ws://127.0.0.1:16726

from the remote device.


Directly refreshing a Dashboard page returns 404

Make sure the Caddyfile contains:

try_files {path} /index.html

This is required for client-side routing used by the Dashboard.


Security notes

This setup is intended for use on a trusted local network.

The FMMatchLens backend remains bound to:

127.0.0.1:16726

and is not exposed directly to the network.

Only Caddy exposes port:

16727

For this reason, it is recommended to:

  • Use this only on trusted Private networks
  • Restrict the Windows Firewall rule to Private networks
  • Avoid forwarding port 16727 on your router
  • Do not expose this configuration directly to the public Internet

Example

Host PC:

LAN IP: 192.168.1.100
FMMatchLens Backend: 127.0.0.1:16726
Caddy: 0.0.0.0:16727

Open on another device:

http://192.168.1.100:16727

The same address provides the Dashboard, API, and WebSocket connection through Caddy.