0

So I set up the caddy server using docker and have set it to proxy to another docker image that is running nodejs. However, when i hit the url it is routing to caddyserver.com instead of my nodejs. Is there something that I am missing:

myserver {
  proxy / 172.17.0.5:8000 {
    header_upstream Host {host}
    header_upstream X-Real-IP {remote}
    header_upstream X-Forwarded-For {remote}
    header_upstream X-Forwarded-Proto {scheme}
  }
}

My docker-compose looks like following:

web:
 image: ca9a385372b0
 env_file: .env
 environment:
 AUTO_ALIASES: /src/docker/aliases/auto
 TERM: xterm-256color
 VIRTUAL_HOST: myserver
 VIRTUAL_PORT: 8000
 volumes:
  - .:/src
ports:
 - "8000:8000"
container_name: web
links:
  - caddy
caddy:
  image: blackglory/caddy-proxy:0.2.1
  env_file: .env
  environment:
  CADDY_OPTIONS: "-email someaddress@myserver.com"
  volumes:
   - /var/run/docker.sock:/tmp/docker.sock:ro
  ports:
   - "80:80"
  - "443:443"

i added following to my /etc/hosts also

127.0.0.1 myserver

However, when I goto http://myserver it redirects me to caddyserver.com

my .env file looks like this

 WEB_VIRTUAL_HOST=myserver
 WEB_VIRTUAL_PORT=8000
  • Where/how are you making your Caddyfile available to Caddy? – mwp Mar 07 '17 at 23:59
  • Ah, I guess it generates one automatically. It looks like you might be missing a volume. The caddy-proxy README also has `-v /data/.caddy:/root/.caddy`. – mwp Mar 08 '17 at 00:07
  • I guess, I was expecting caddy to pick it up from /etc/Caddyfile where the file was created by the caddy docker image. however, I did add VOLUME `${HOME}/.caddy:/root/.caddy` but it didnt work – rockclimbing utah Mar 08 '17 at 00:12
  • caddy will find the Caddyfile in the directory that contains the caddy binary - otherwise you can specify another location by using -conf=path/to/Caddyfile – Toby Allen Mar 08 '17 at 12:16
  • The caddy file is set correctly i assume. When I goto localhost it also redirects me to caddyserver website which seems weird. – rockclimbing utah Mar 08 '17 at 17:47

0 Answers0