Caddyfile (GMM) — VS Code ExtensionCaddyfile support with a real language server. Catch what Works in VS Code and every Open VSX editor (VSCodium, Cursor, Windsurf, Gitpod, Eclipse Theia). Built and maintained by Juan Torchia as part of GMM Software Solutions.
Why another Caddyfile extensionMost Caddyfile extensions highlight syntax and, at best, shell out to It was checked against 400+ Caddyfiles that FeaturesValidation that mirrors
|
| Check | Severity | Example |
|---|---|---|
| Unbalanced braces, unterminated strings, broken heredocs | Error | example.com { never closed, <<END! |
| Global options block not first | Error | A { … } block after a site |
| Site addresses Caddy cannot parse | Error | example.com{, a.com,b.com, a directive used as an address, a second site without braces |
| Duplicate site addresses | Error | example.com in two site blocks (unless bind separates them) |
| Option or directive in the wrong place | Error | email inside a site, reverse_proxy in the global options, tls/log/bind/handle_errors inside handle or route, copy_response outside handle_response |
| Named matchers | Error | respond @missing 404 with no @missing in scope, @api defined twice in one block, @api /path (a path, not a matcher name), @api with no condition |
| Snippets and named routes | Error / Warning | invoke api with no &(api), a snippet or named route defined twice, import securty with no such snippet or file |
| Unknown directive, global option, subdirective or matcher | Warning | rate_limit, file_server { browze } — they may come from a plugin; list yours in caddy.validate.ignoredDirectives |
Unknown {http.request.*} placeholder |
Warning | {http.request.hots} (Caddy silently replaces it with nothing) |
| Renamed directive | Information | basicauth → quick fix to basic_auth |
| Imported file or certificate not found | Information | import sites/*.caddy is fine when empty; import common.caddy is not |
Snippets and imported files are read the way Caddy reads them: a file that starts with directives is a fragment checked as the body of a site, a block of subdirectives (header_up, lb_policy, …) is left alone, and {args[0]}, {block} and {$ENV} lines are never reported. Snippets and named routes defined in the files you import are found too.
TLS lint against the Mozilla guidelines
Caddy's TLS defaults already follow the Mozilla intermediate profile, so a Caddyfile that does not touch them is silent. When you do, tls { protocols … ciphers … } is checked against the Mozilla Server Side TLS profile in caddy.tls.profile (intermediate or modern; guideline 6.0). The rule IDs are shared with NGINX Config, Apache Config and HAProxy Config.
| Rule | Severity | Example |
|---|---|---|
tls-weak-protocol |
Warning | protocols tls1.0 — quick fix: tls1.2 |
tls-protocol-not-in-profile |
Information | protocols tls1.2 under modern — quick fix: tls1.3 |
tls-weak-cipher |
Warning | 3DES, RC4, CBC with SHA-1, RSA key exchange |
tls-cipher-not-in-profile |
Information | A TLS 1.2 suite outside the profile |
tls-hsts-short-max-age |
Information | header Strict-Transport-Security max-age=31536000 — quick fix: 63072000 |
tls-secrets-log |
Warning | insecure_secrets_log writes the session keys to a file |
tls-insecure-skip-verify |
Warning | tls_insecure_skip_verify in a reverse_proxy transport |
A missing HSTS header is never reported: that is a choice, not a misconfiguration. Silence a line with a comment:
# gmm-lint-disable-next-line tls-weak-protocol
protocols tls1.1
reverse_proxy legacy:8443 # gmm-lint-disable-line
Security lint
Conservative rules written for Caddy, which is secure by default: each fires only on what the file changes.
| Rule | Severity | Example |
|---|---|---|
sec-admin-exposed |
Warning | admin :2019 or admin 0.0.0.0:2019 — anyone who reaches it can replace the config |
sec-basic-auth-plaintext |
Warning | basic_auth { bob hunter2 } — not a bcrypt/argon2id hash |
sec-internal-ca-public |
Information | tls internal (or local_certs) on a public name such as shop.example.dev |
sec-on-demand-unrestricted |
Warning | tls { on_demand } without an on_demand_tls { ask … } |
sec-proxy-host-placeholder |
Warning | reverse_proxy {host}:8080 — the client picks the upstream |
See docs/security-lint.md for what each rule checks and what it deliberately leaves alone.
Certificate insights

Hover the files of tls <cert_file> <key_file> (or ca_root) to see the subject, SANs, issuer, validity with the days left, key type and chain, with an Open in CertView link; hover the key to see its type and whether it matches the certificate — never its content.
| Check | Severity |
|---|---|
cert-expired / cert-expiring — within caddy.certificates.expiryWarningDays (30); Caddy never renews certificates it loads from files |
Warning |
cert-key-mismatch — the key does not belong to the certificate |
Error |
cert-key-unverifiable — the key is encrypted |
Information |
cert-name-mismatch — a site address is not in the certificate's SANs |
Warning |
cert-chain-order / cert-chain-incomplete — the file is not leaf-first, or the intermediate is missing |
Information |
Only files inside your workspace are read (production paths such as /etc/caddy/certs/site.pem are mapped into it). To read files elsewhere on this machine, turn on caddy.certificates.allowOutsideWorkspace. With the free CertView extension installed, an Open in CertView CodeLens with the days until expiry appears above the certificate.


Hover docs, completion and placeholders



- Hover any directive, global option, subdirective or matcher for its syntax, description and a link to caddyserver.com; hover a
{placeholder}for what it holds (shorthands show the placeholder they stand for); hover@nameto see the matcher's definition. - Completion knows where you are: global options in the global block, directives in sites (only HTTP handlers inside
handle/route,copy_responseinsidehandle_response), subdirectives in directive blocks (including nested ones such astls { client_auth { … } }and thosephp_fastcgiandforward_authinherit fromreverse_proxy), matchers in matcher sets, your@matchersand snippet names, and every placeholder after{.
Navigation and outline

- Imports: Ctrl/Cmd+click an imported file; go to definition on
import namejumps to the snippet (in this file or an imported one), oninvoke nameto the named route, on@nameto the matcher, on certificate paths to the file. - Outline of the global options, snippets, named routes and sites with their directives and matchers, and folding for blocks, heredocs and comment runs.
A formatter consistent with caddy fmt that never deletes lines

Format Document indents with tabs, puts one space between tokens and before trailing comments, and trims trailing whitespace — the result caddy fmt gives, checked against caddy fmt itself on the whole corpus. Unlike caddy fmt it never joins, splits, adds or removes lines (blank lines and a { on its own line stay), and never touches heredocs, quoted text or comments. Running it twice changes nothing.
Optional: run Caddy
If caddy is installed (or set caddy.executable in your user settings), three commands use it in trusted workspaces:
- Caddy: Check with caddy adapt runs
caddy adapt --validateon the saved file and shows its errors and warnings as problems. - Caddy: Show Adapted JSON opens the JSON config the Caddyfile adapts to.
- Caddy: Hash Password for basic_auth runs
caddy hash-passwordand inserts the bcrypt hash at the cursor.
Syntax highlighting and snippets

TextMate grammar for sites, snippets, named routes, directives, @matchers, placeholders, {$ENV} variables, strings, backticks, heredocs, numbers and comments. Snippets: site, global, proxy, files, spa, php, @matcher, snippet, handle_path, redirwww, basic_auth, headers.
File detection
The caddyfile language is used for Caddyfile, Caddyfile.*, Caddyfile-*, *.caddyfile, *.Caddyfile and *.caddy. Files that a Caddyfile in the workspace imports (import snippets/*, import sites/app.conf) switch to Caddyfile when you open them, whatever their name. For anything else, pick Caddyfile in the language picker or add a files.associations entry.
Settings
| Setting | Default | Description |
|---|---|---|
caddy.validate.enable |
true |
Live diagnostics. |
caddy.validate.unknownDirectives |
true |
Warn about names outside standard Caddy. |
caddy.validate.ignoredDirectives |
[] |
Plugin directives, options, subdirectives and matchers never reported as unknown. |
caddy.validate.missingFiles |
true |
Report imported files and certificate files that cannot be found locally (information). |
caddy.validate.placeholders |
true |
Warn about unknown {http.request.*} placeholders. |
caddy.tls.lint.enable |
true |
Check TLS settings against the Mozilla guidelines. |
caddy.tls.profile |
intermediate |
Mozilla profile: intermediate or modern. |
caddy.tls.lint.disabledRules |
[] |
TLS rule IDs that are never reported. |
caddy.security.lint.enable |
true |
Report security misconfigurations. |
caddy.security.lint.disabledRules |
[] |
Security rule IDs that are never reported. |
caddy.certificates.diagnostics |
true |
Expiry, key match, SAN and chain checks. |
caddy.certificates.expiryWarningDays |
30 |
Days before expiry that cert-expiring starts. |
caddy.certificates.allowOutsideWorkspace |
false |
Read certificate and key files outside the workspace. |
caddy.completion.enable |
true |
Context-aware completion. |
caddy.certView.codeLens |
true |
Show Open in CertView when CertView is installed. |
caddy.executable |
caddy |
The binary for the optional Caddy commands. |
caddy.trace.server |
off |
Language server protocol tracing. |
Privacy
No telemetry, no network access. The extension reads the Caddyfiles you open and the files they import or reference inside your workspace (outside it only if you opt in). Private keys are only checked against their certificate; their content is never shown or sent anywhere. The caddy binary only runs when you invoke one of the Caddy commands.
Development
npm ci && npm ci --prefix client && npm ci --prefix server
npm run build
npm test # unit + integration (integration needs a display, e.g. xvfb-run)
npm run catalog:generate # refresh the catalog from the pinned Caddy docs and source
npm run tls:generate # refresh the Mozilla TLS profiles (pinned guideline)
npm run tlds:generate # refresh the IANA TLD list used by the security lint
scripts/check-with-caddy.sh # check the corpus with caddy adapt and caddy fmt (Docker)
See docs/development.md, docs/architecture.md, docs/tls-lint.md, docs/security-lint.md, docs/certificates.md and docs/competitive.md.
Need help with this in your team's workflow? See how to work with GMM.

