Skip to content

Traefik as reverse proxy for local development using Docker and mkcert

License

Notifications You must be signed in to change notification settings

birros/docker-traefik-mkcert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traefik as reverse proxy for local development

Scaffolding of a reverse proxy for local development :

  1. traefik watch docker to detect new web services to be exposed locally
  2. mkcert is used as ssl provider for valid certificates in browsers

Setup (macOS)

$ brew install mkcert
$ brew install nss
$ mkcert -install
$ make      # start
$ make down # stop

Dashboard available here: https://dashboard.dev.localhost

Example of web service (whoami)

$ make whoami-up   # start
$ make whoami-down # stop

Whoami available here: https://whoami.dev.localhost

Remarks

By default only linux point addresses <subdomain>.localhost to localhost, which is not necessarily the case on all systems. In this case a solution could be to use dnsmasq to point the <subdomain>.localhost addresses to localhost.

macOS

$ brew install dnsmasq
$ mkdir -pv $(brew --prefix)/etc/
$ echo 'address=/.localhost/127.0.0.1' >> $(brew --prefix)/etc/dnsmasq.conf
$ sudo brew services start dnsmasq
$ sudo mkdir -v /etc/resolver
$ sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/localhost'

About

Traefik as reverse proxy for local development using Docker and mkcert

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published