8

I have a site set up with caddy that serves a react app. But the proxy part of it doesn't seem to be forwarding requests to the other docker container. It still shows me the react page on example.com/api.

My caddyfile:

example.com {
    gzip

    root /app/build    # directory of public pages # Single-page react app

    proxy /staticfiles django:8000 {
        transparent
    }
    proxy /api django:8000 {
        transparent
    }
}
cclloyd
  • 8,171
  • 16
  • 57
  • 104

1 Answers1

-1

If you're using docker run:

Use --network to connect containers:

docker run --rm --network app django    
docker run --rm --network app mycaddydockerimage    

If you're using docker-compose:

Use --links:

version: '2.1'
services:
  django:
    image: django
  mycaddydockerimage:
    image: something
    links:
    - django
Atila Romero
  • 359
  • 3
  • 7
  • 2
    Links have been deprecated for some time now. Please use a shared user created network which exists by default with compose file version 2 and greater. – BMitch Jul 31 '18 at 16:31