fusionauth-containers
fusionauth-containers copied to clipboard
Reverse Proxy Not Working
Reverse proxying via caddy doesn't work. It gives 502
CaddyFile Content As below
# replace :80 with your domain name to get automatic https via LetsEncrypt
https://<your_domain> {
reverse_proxy fusionauth:9011
}
- fusionauth is service running in docker
- caddy is running as service running in docker with above CaddyFile
This issue/PR may be worth reviewing, as I think @atakane got this working: https://github.com/FusionAuth/fusionauth-containers/pull/61
Reverse proxying via caddy doesn't work. It gives 502
CaddyFile Content As below
# replace :80 with your domain name to get automatic https via LetsEncrypt https://<your_domain> { reverse_proxy fusionauth:9011 }
fusionauth is service running in docker
caddy is running as service running in docker with above CaddyFile
did you try without the protocol? Caddy wants us to write domain like auth.mydomain.com rather than https://auth.mydomain.com
Yes, i tried.
Actually i copied hasura's caddy part for CaddyFile and docker and replaced necessary params on a different server.
https works in hasura but i tried both before posting here.
Even ip gives 502. Only accessing via :9011 working for now
Hi, did you find a solution for this?
My solution to this challenge, I used docker for everything, hope it works for others. Unfortunately I wasn't able to use DigitalOcean managed database, I always get connection error, but this is another story.
docker-compose.yml
version: "3"
services:
http:
image: caddy:latest
container_name: http
restart: unless-stopped
ports:
- 80:80
- 443:443
networks:
- network
volumes:
- $PWD/Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
db:
image: postgres:11.9-alpine
container_name: db
environment:
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
networks:
- network
restart: unless-stopped
volumes:
- db_data:/var/lib/postgresql/data
fusionauth:
image: fusionauth/fusionauth-app:latest
container_name: fusionauth
depends_on:
- db
- http
environment:
DATABASE_URL: ${DATABASE_URL}
DATABASE_ROOT_USERNAME: ${POSTGRES_USER}
DATABASE_ROOT_PASSWORD: ${POSTGRES_PASSWORD}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
FUSIONAUTH_APP_MEMORY: ${FUSIONAUTH_APP_MEMORY}
FUSIONAUTH_APP_RUNTIME_MODE: production
SEARCH_TYPE: database
networks:
- network
restart: unless-stopped
volumes:
- fa_config:/usr/local/fusionauth/config
networks:
network:
volumes:
db_data:
fa_config:
caddy_data:
caddy_config:
Caddyfile
auth.my-domain.com {
reverse_proxy fusionauth:9011
}
The solution to the problem is network.
I read line by line with @allochi's solution and found this one thing extra
Do take care that caddy and fusionauth are on same network
@narayanpromax thanks so much for closing the issue after you found a solution.