> ## Content Index
> Fetch the complete content index at: https://ping2prompt.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Traefik: close api.insecure and put the dashboard behind authentication
- URL: https://ping2prompt.com/traefik-close-api-insecure-dashboard-authentication/
- Published: 2026-11-16T03:41:19.000Z
- Updated: 2026-11-16T22:53:08.000Z
- Description: Traefik's api.insecure option exposes the API and dashboard, including sensitive configuration data, on the traefik entryPoint. Check your files, set it to false, and put the dashboard behind a basicAuth middleware with hashed passwords, keeping the API port off public networks.
- Author: Ping2Prompt Newsroom
- Tags: Traefik, The Friday Footgun, #auto, #docs-reviewed, #short-ping

## The default

Here is the setting to look for in your own files. The api.insecure option switches on the API and the dashboard on the entryPoint named traefik. It defaults to false, so someone has to turn it on.

Separately, setting api to true also turns on the dashboard, which itself defaults to true. We have no data on how common this is in copied files, so check yours rather than assume.

## Why it bites

The dashboard is a page that pulls its data from the API. That API describes your routers, services, middlewares and similar objects. According to the docs, enabling it will "expose all configuration elements, including sensitive data."

The docs say enabling it in production is not recommended. Reading it takes nothing special, because the endpoints answer plain GET requests. Documented paths cover HTTP routers, services and middlewares, with matching TCP paths.

The vendor says not to expose the API port publicly and to keep it on internal networks. If you do run it in production, the docs say to secure it with authentication and authorizations at the least. On a flat LAN or a loosely isolated VLAN, internal can include more machines than you think.

We could not confirm from our sources whether insecure mode asks for any login. Route and middleware names alone can map your services for anyone who reads them.

## How to check

First, search your compose files and static config for the option by running grep -rn 'api.insecure' . in your stacks folder (verify before running). Next, from a different machine on the network, request the router list with curl -s http://TRAEFIK\_HOST:PORT/api/http/routers (verify before running). Use the port of your traefik entryPoint, because our sources do not state its default.

If JSON comes back, that machine can read your router configuration. Repeat the same curl form for /api/http/services and /api/http/middlewares (verify before running). We could not confirm an /api/rawdata endpoint in the docs, so test the documented paths instead.

Also look for a router that uses the api@internal service, and see whether it lists a middlewares entry. If you enabled api.debug, extra debugging and profiling endpoints are on as well.

## The fix

Set api.insecure to false or remove it, since false is already the default. The cost is that the dashboard no longer appears on the traefik entryPoint, so you have to route it yourself. The documented pattern is a router with a Host rule plus PathPrefix for /api or /dashboard, the service api@internal, and a middlewares entry pointing at a basicAuth middleware.

In Docker labels, that means setting the dashboard router's service to api@internal and its middlewares to auth. basicAuth passwords must be hashed with MD5, SHA1 or BCrypt, and htpasswd can generate them. Passwords longer than 1024 bytes are rejected. In compose labels, double every dollar sign in the hash, and generate the pair with htpasswd -nB user (verify before running).

Do not double them where compose does not evaluate the value, such as the Ansible docker\_container module. On Kubernetes, use the secret field instead of users or usersFile. According to the docs, a basic-auth secret stores the username and password unhashed, which they call "less secure than other methods."

If you copy the Helm example, note that it uses the websecure entryPoint and a placeholder admin and changeme login. The docs tell you to replace that password. Keep the API port off public networks as well.

Our sources do not cover forward-auth, so we give no steps for it. The ongoing cost is one hashed credential to manage and a hostname to remember.

## Friday checklist

Search every compose file and config for insecure mode. Request the API from a second host and confirm it no longer answers. Put the dashboard behind authentication with a properly hashed password. Replace any placeholder login you copied from an example.

## Sources

- [doc.traefik.io/traefik/reference/install-configuration/api-dashboard](https://doc.traefik.io/traefik/reference/install-configuration/api-dashboard/?ref=ping2prompt.com)
- [raw.githubusercontent.com/traefik/traefik/master/docs/content/reference/routing-co…](https://raw.githubusercontent.com/traefik/traefik/master/docs/content/reference/routing-configuration/http/middlewares/basicauth.md?ref=ping2prompt.com)

Image: [Photo by Jonathan on Unsplash](https://unsplash.com/photos/white-and-gray-cable-SwVkmowt7qA?utm%5Fsource=ping2prompt&utm%5Fmedium=referral)

---

This story was produced with AI assistance from the sources listed above and fact-checked against them before publication. Read our [editorial methodology](https://ping2prompt.com/about-how-we-work/) and the [corrections log](https://ping2prompt.com/corrections/). Spotted an error? Email [editor@ping2prompt.com](mailto:editor@ping2prompt.com).