Skip to main content

Reverse Proxy

Put the bundled Caddy reverse proxy in front of IntelliAsk for HTTPS — TLS modes, enabling at provision time, and turning it on or off later without a full re-provision.

The stack ships a bundled Caddy reverse proxy (proxy.compose.yml) that terminates TLS in front of IntelliAsk. It is opt-in: its PROXY_* settings live in the single config/.env, and intelliask only references it when PROXY_ENABLED is truthy.

Caddy is optional — bring your own proxy

The bundled Caddy proxy is provided purely as a convenience. It is in no way required — IntelliAsk is just an HTTP app listening on port 3080, so you can put any reverse proxy in front of it: nginx, Traefik, HAProxy, an existing corporate load balancer, or a tunnel such as ngrok/Cloudflare Tunnel.

To use your own, leave the bundled proxy disabled (PROXY_ENABLED=false, the default) and point your proxy at the IntelliAsk container/host on port 3080. You'll typically also want to:

  • Set INTELLIASK_BIND=127.0.0.1: (or a private interface) so the app port isn't exposed publicly and only your proxy can reach it.
  • Set PUBLIC_SCHEME=https, PUBLIC_HOST to your public DNS name, and TRUST_PROXY=1 so IntelliAsk builds correct URLs and sees the real client IP behind your proxy.

The rest of this page covers only the bundled Caddy option; if you use your own proxy you can skip it entirely.

What the proxy changes

When the proxy is enabled:

  • IntelliAsk is bound to loopback only (127.0.0.1) and the proxy publishes the public port instead — 443 for any TLS mode, or 80 for off.

The proxy only fronts the IntelliAsk web UI. The Code Interpreter (codeapi) is reached directly over the internal network with a signed JWT, so it does not depend on the proxy.

When disabled, only the IntelliAsk UI (3080) and, when enabled, the exporter (9100) are published to the host; everything else stays internal.

TLS modes

ModeBehaviourUse when
internal (default)Caddy's internal CA issues a cert. HTTPS works immediately, no files or public DNS needed.Internal hosts / first-time setup.
fileUses a supplied cert.pem / key.pem (e.g. an internal-CA certificate).You have your own certificate.
autoPublic ACME / Let's Encrypt certificates. Requires public DNS pointing at the host and an ACME email.Public-facing deployments.
offPlain HTTP on port 80, no certificate.Behind another TLS terminator.

The default internal mode means first-time provisioning gets working HTTPS without requiring cert.pem/key.pem.

Enable at provision time

# Default internal-CA HTTPS on 443
intelliask provision --with-proxy
 
# Explicit TLS mode
intelliask provision --proxy-mode internal
 
# Public Let's Encrypt certificates
intelliask provision --proxy-mode auto --proxy-email ops@example.com

--proxy-mode implies --with-proxy. The choice is persisted as PROXY_ENABLED in config/.env, so day-2 commands and the systemd service honour it too.

Provision asks for the public DNS name

When the proxy is enabled, the interactive Configuration step of provision prompts for the public DNS name clients use to reach IntelliAsk and stores it as PUBLIC_HOST in config/.env (Caddy's server_name). It also offers to expose the metrics exporter through the proxy — see Exposing the metrics exporter.

Exposing the metrics exporter

The Prometheus exporter can optionally be served through the proxy under its own DNS name (with the same TLS mode), instead of publishing host port 9100. Toggle it with flags on module enable proxy, which sets everything up and re-applies in one step:

intelliask module enable proxy --exporter-host metrics.example.com
intelliask module enable proxy --no-exporter   # stop fronting it, keep the proxy up

--exporter-host sets EXPORTER_PROXY_ENABLED=true and EXPORTER_PUBLIC_HOST, and binds the raw :9100 port to 127.0.0.1 so it stays off the public interface. The binary keeps EXPORTER_BIND in step: when the exporter site goes away (--no-exporter, module disable proxy), :9100 is published on all interfaces again so Prometheus can scrape it directly. A custom value (e.g. an interface IP) is left alone. You can pass it alongside the other proxy flags in one call:

intelliask module enable proxy --host intelliask.example.com --exporter-host metrics.example.com

Caddy adds a second site for EXPORTER_PUBLIC_HOST that reverse-proxies to the exporter (EXPORTER_PROXY_UPSTREAM, default exporter:8000), sharing the stack's TLS mode. When TLS mode is off it becomes a plain-HTTP site on port 80, like the IntelliAsk site.

You can instead serve it under a path of the IntelliAsk site — no extra DNS name or certificate. Caddy routes the prefix to the exporter and strips it, so Prometheus scrapes https://<PUBLIC_HOST>/prometheus/metrics (/metrics itself is an IntelliAsk route):

intelliask module enable proxy --exporter-path /prometheus
intelliask module enable proxy --no-exporter-path

The metrics endpoint has no authentication, so restrict who can reach it when you publish it either way. At provision time the interactive Configuration step also offers this when the proxy is enabled. See the Prometheus Exporter page for the metrics details.

Bring-your-own proxy for the exporter too

This Caddy-based exposure is just a convenience — like the main app, the exporter is plain HTTP (container port 8000, host port 9100), so any reverse proxy (nginx, Traefik, ngrok, …) can front it. To do it yourself, leave EXPORTER_PROXY_ENABLED=false and EXPORTER_PUBLIC_HOST / EXPORTER_PUBLIC_PATH empty, run intelliask module enable exporter --local-only so the raw :9100 port isn't public, and point your proxy at the exporter on port 9100 (host) or exporter:8000 (in-network).

Or set the variables by hand

Those flags just write these keys in config/.env and re-render the Caddyfile — you can edit them directly and run intelliask up (or intelliask module enable proxy) instead:

# config/.env
EXPORTER_PROXY_ENABLED=true
EXPORTER_PUBLIC_HOST=metrics.example.com
EXPORTER_PROXY_UPSTREAM=exporter:8000   # default; the in-network exporter address
# EXPORTER_BIND is set for you on the next intelliask command (127.0.0.1: while fronted)

Same scheme as IntelliAsk

The exporter, Admin Panel and IntelliCollab sites always use the IntelliAsk site's scheme. In the TLS modes (auto, internal, file) each hostname gets HTTPS on port 443 with the same certificate handling. With --mode off they are plain-HTTP sites on port 80, matched by hostname. Set PUBLIC_SCHEME=http in that case so the generated URLs (PUBLIC_URL, INTELLICOLLAB_PUBLIC_URL, ADMIN_PANEL_BASE_URL) match — unless TLS is terminated by another proxy in front of Caddy. intelliask doctor warns about the mismatch.

Exposing the Admin Panel

The optional Admin Panel listens on 127.0.0.1:8090 only. To reach it on its own DNS name with the proxy's TLS, use the same pattern as the exporter:

intelliask module enable proxy --admin-host admin.example.com
intelliask module enable proxy --no-admin   # stop fronting it, keep the proxy up

This sets ADMIN_PANEL_PROXY_ENABLED=true / ADMIN_PANEL_PUBLIC_HOST, keeps the raw port on loopback, points ADMIN_PANEL_BASE_URL at ${PUBLIC_SCHEME}://<host> and adds a Caddy site proxying to admin-panel:8000 (ADMIN_PANEL_PROXY_UPSTREAM). The site is only rendered while the admin-panel module is enabled and uses the same scheme as IntelliAsk: HTTPS in the TLS modes, plain HTTP on port 80 when TLS mode is off. See Admin Panel → Serving it on its own DNS name.

Under a path of the IntelliAsk site

If you'd rather not add a DNS name, serve the panel under a path of the IntelliAsk site instead — e.g. https://intelliask.example.com/admin/ — using the same hostname and certificate:

intelliask module enable proxy --admin-path /admin
intelliask module enable proxy --no-admin-path   # remove the route, keep the proxy up

This sets ADMIN_PANEL_PUBLIC_PATH=/admin, which the panel receives as its ROOT_PATH, and adds a route to the IntelliAsk site: /admin redirects to /admin/, everything under /admin/ goes to admin-panel:8000, and every other path still reaches IntelliAsk. ADMIN_PANEL_BASE_URL becomes ${PUBLIC_URL}/admin. The path must not shadow an IntelliAsk route — /api, /c, /login, /oauth, /share, /assets, /agents, /intellicollab and similar are refused.

A separate hostname is the safer choice

On a path, the panel shares the IntelliAsk origin, so script running on the IntelliAsk site could read the panel's sign-in token from browser storage. Prefer --admin-host for internet-facing installs; use --admin-path on trusted networks or where an extra DNS name isn't an option.

Exposing IntelliCollab

When the optional IntelliCollab module is enabled, Caddy adds another site for INTELLICOLLAB_PUBLIC_HOST that reverse-proxies to intellicollab:8000 (INTELLICOLLAB_PROXY_UPSTREAM), sharing the stack's TLS mode, and binds host port 8100 to 127.0.0.1 only. The hostname is set with intelliask module enable intellicollab --host collab.example.com and must differ from PUBLIC_HOST — generated apps must never share the IntelliAsk origin. As with the exporter, the site follows the stack's scheme: with TLS mode off it is a plain-HTTP site on port 80 (a host given with a port, e.g. box:8100, is reached on that raw port instead and gets no site). See Enabling it in the IntelliAsk stack.

Turn it on or off later

You don't need a full re-provision to change the proxy. The proxy is an optional module; toggle it with intelliask module (it edits config/.env and re-applies):

intelliask module enable proxy                    # default/kept TLS mode
intelliask module enable proxy --mode auto --email ops@example.com --host intelliask.example.com
intelliask module disable proxy                   # back to direct :3080
intelliask module list                            # show current module state
FlagEffect
--mode <mode>TLS mode for enable: file | internal | auto | off. Defaults to whatever is in config/.env (or internal).
--email <addr>ACME contact email (only used by --mode auto).
--host <name>Public DNS name for IntelliAsk (sets PUBLIC_HOST).
--exporter-host <name>Also expose the metrics exporter through the proxy under this DNS name.
--no-exporterStop fronting the exporter through the proxy, keeping the proxy up.
--admin-host <name>Also expose the Admin Panel through the proxy under its own DNS name.
--no-adminStop serving the Admin Panel on its own DNS name, keeping the proxy up.
--admin-path <path>Also serve the Admin Panel under this path of the IntelliAsk site, e.g. /admin.
--no-admin-pathRemove the Admin Panel path route, keeping the proxy up.
--no-applyWrite the env changes but don't touch Docker (apply later with intelliask up).

Flags may come before or after the module name (intelliask module enable proxy --mode auto and intelliask module enable --mode auto proxy are equivalent).

Enabling/disabling flips PROXY_ENABLED and INTELLIASK_BIND in config/.env, then recreates the stack so the change takes effect. The proxy container is restarted afterwards so Caddy always loads the freshly rendered Caddyfile.

Setting the public DNS name

module enable proxy no longer prompts for a hostname — pass --host <name> (or set PUBLIC_HOST in config/.env) for auto/file modes. internal and off modes don't need one. Re-running intelliask provision --with-proxy will prompt for it interactively instead.

file mode certificates

For --proxy-mode file, place your cert.pem and key.pem where the proxy expects them (under config/proxy/) before enabling. For auto, make sure the host's public DNS record already resolves to the VM so ACME validation can succeed.

Last updated on