Skip to content

Reverse proxy setup for local development using Docker and Traefik

Notifications You must be signed in to change notification settings

apicore-engineering/traefik-local-dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Reverse proxy setup for local development using Docker and Traefik.

Requirements

You should have a working Docker setup with docker-compose included. See https://docs.docker.com for details.

Setup

docker network create traefik
docker-compose up -d

Usage

To enable the local reverse proxy for your project on a custom domain, you have to add a few labels and the traefik network to the container you want to expose.

Here is a basic docker-compose.yml example on how to configure the reverse proxy on the domain domain.example:

version: '2.4'
services:
  example:
    image: nginx
    labels:
      - "traefik.docker.network=traefik"
      - "traefik.enable=true"
      - "traefik.http.routers.example.rule=Host(`domain.example`)"
    networks:
      - default
      - traefik

For further information on the labels, see the official Traefik documentation: https://doc.traefik.io/traefik/providers/docker/

Do not forget to add domain.example to your local DNS server or your hosts file to resolve to localhost.

About

Reverse proxy setup for local development using Docker and Traefik

Resources

Stars

Watchers

Forks