Railway

Deploy Traefik with Dashboard

[Jun'26] Self-hosted Traefik with dashboard and editable Railway config

Deploy Traefik with Dashboard

traefik

traefik

Just deployed

/data

Deploy and Host Traefik on Railway

Traefik is a modern open-source reverse proxy and edge router for routing traffic to backend services. It supports HTTP routing, load balancing, middleware, dashboards, and dynamic configuration, making it useful for APIs, web applications, microservices, and self-hosted infrastructure.

About Hosting Traefik

Hosting Traefik on Railway gives you a lightweight way to run a proxy and routing layer in front of your services. This template can route traffic to Railway private services, external HTTP services, APIs, dashboards, or self-hosted applications.

This template includes a working Traefik Dashboard and uses file-based dynamic configuration. Routing rules can be edited through Railway Console or Railway CLI by updating the dynamic configuration file stored in the Railway Volume.

When deployed, the root URL automatically redirects to the Traefik Dashboard, so you can confirm the service is running immediately after deployment.

Imgur

Common Use Cases

  • Reverse proxy for web applications, APIs, dashboards, and internal services
  • Routing traffic to Railway private services using *.railway.internal domains
  • Creating a lightweight edge router for microservices or self-hosted apps
  • Load balancing requests across multiple backend services
  • Managing routing rules through Railway Console or Railway CLI
  • Monitoring routers, services, middlewares, and entrypoints from the Traefik Dashboard

Key Features

  • 1-click Traefik deployment on Railway
  • Built-in Traefik Dashboard
  • Root URL redirects automatically to /dashboard/
  • File-based dynamic configuration
  • Editable routing rules through Railway Console or Railway CLI
  • Persistent custom routing configuration using Railway Volume
  • Supports Railway private networking
  • Supports internal and external backend services
  • Suitable for APIs, web apps, dashboards, and microservices

Dependencies for Traefik Hosting

  • Traefik Docker image
  • Railway public networking
  • Railway private networking for internal service routing
  • Railway Volume mounted at /data
  • Dynamic configuration file at /data/dynamic.yml

Deployment Dependencies

How It Works

This template uses Traefik with file-based dynamic configuration.

The editable routing file is located at:

/data/dynamic.yml

This file controls routers, services, middlewares, and backend targets.

The default configuration includes:

  • A router for the Traefik Dashboard
  • A redirect from / to /dashboard/
  • Dashboard access through /dashboard/
  • API access through /api/

After deployment, open your Railway public URL. The root URL will redirect to:

/dashboard/

The Traefik Dashboard is useful for checking active routers, services, middlewares, and routing status. It is mainly for monitoring and debugging. Configuration changes are still managed through /data/dynamic.yml.

Traefik Dashboard

After deployment, open the generated Railway public URL.

Example:

https://your-traefik-service.up.railway.app

It will redirect to:

https://your-traefik-service.up.railway.app/dashboard/

From the dashboard, you can monitor:

  • Routers
  • Services
  • Middlewares
  • EntryPoints
  • Routing status
  • Provider configuration
  • Backend routing health

The dashboard does not work like a full proxy manager UI. You cannot add or edit routes directly from the dashboard. To change routing behavior, update /data/dynamic.yml.

Dynamic Configuration File

The routing configuration is stored in:

/data/dynamic.yml

Example configuration for the dashboard and root redirect:

http:
  routers:
    root-redirect:
      rule: "Path(`/`)"
      entryPoints:
        - web
      middlewares:
        - redirect-to-dashboard
      service: noop@internal

    dashboard:
      rule: "PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
      entryPoints:
        - web
      service: api@internal

  middlewares:
    redirect-to-dashboard:
      redirectRegex:
        regex: "^https?://([^/]+)/?$"
        replacement: "https://${1}/dashboard/"
        permanent: false

Route to a Railway Private Service

To route traffic to another Railway service, update /data/dynamic.yml.

Example:

http:
  routers:
    app:
      rule: "PathPrefix(`/`)"
      entryPoints:
        - web
      service: app-service

  services:
    app-service:
      loadBalancer:
        servers:
          - url: "http://your-service.railway.internal:3000"

Replace:

your-service.railway.internal:3000

with your actual Railway private service domain and port.

Route to an External Backend

Example route to an external backend:

http:
  routers:
    external:
      rule: "PathPrefix(`/`)"
      entryPoints:
        - web
      service: external-service

  services:
    external-service:
      loadBalancer:
        servers:
          - url: "https://example.com"

Update Configuration via Railway Console

Open your Traefik service in Railway, then open the Console tab.

View the current dynamic configuration:

cat /data/dynamic.yml

Overwrite the dynamic configuration:

cat > /data/dynamic.yml <<'EOF'
http:
  routers:
    root-redirect:
      rule: "Path(`/`)"
      entryPoints:
        - web
      middlewares:
        - redirect-to-dashboard
      service: noop@internal

    dashboard:
      rule: "PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
      entryPoints:
        - web
      service: api@internal

    app:
      rule: "PathPrefix(`/app`)"
      entryPoints:
        - web
      service: app-service

  services:
    app-service:
      loadBalancer:
        servers:
          - url: "http://your-service.railway.internal:3000"

  middlewares:
    redirect-to-dashboard:
      redirectRegex:
        regex: "^https?://([^/]+)/?$"
        replacement: "https://${1}/dashboard/"
        permanent: false
EOF

Check the file again:

cat /data/dynamic.yml

If routing does not update automatically, restart the service from Railway.

Update Configuration via Railway CLI

Install and authenticate Railway CLI:

railway login
railway link

Open an interactive shell inside the deployed Traefik service:

railway ssh

View the current config:

cat /data/dynamic.yml

Edit or overwrite the dynamic configuration:

cat > /data/dynamic.yml <<'EOF'
http:
  routers:
    root-redirect:
      rule: "Path(`/`)"
      entryPoints:
        - web
      middlewares:
        - redirect-to-dashboard
      service: noop@internal

    dashboard:
      rule: "PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
      entryPoints:
        - web
      service: api@internal

    app:
      rule: "PathPrefix(`/`)"
      entryPoints:
        - web
      service: app-service

  services:
    app-service:
      loadBalancer:
        servers:
          - url: "http://your-service.railway.internal:3000"

  middlewares:
    redirect-to-dashboard:
      redirectRegex:
        regex: "^https?://([^/]+)/?$"
        replacement: "https://${1}/dashboard/"
        permanent: false
EOF

Exit the shell:

exit

Restart the service if needed:

railway restart

Important Notes

  • The Traefik Dashboard is for monitoring and debugging, not editing routes.
  • Routing rules are managed through /data/dynamic.yml.
  • Use Railway Console or Railway CLI to edit the configuration.
  • Attach a Railway Volume to /data so config changes survive restarts and redeployments.
  • Use Railway private service domains such as your-service.railway.internal for internal routing.
  • If routing changes do not apply immediately, restart the Traefik service.
  • The root URL redirects to /dashboard/ by default.
  • For production, avoid exposing sensitive dashboard or API endpoints publicly without proper access control.

Why Deploy Traefik on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Traefik on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

traefik

traefik

More templates in this category

View Template
Rocky Linux
[Jun'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta