Port baked into PULLPREVIEW_URL causing issues
geoffatsource opened this issue · comments
I'd like to be able to set up Caddy to serve from two different ports but since the port is baked into the env variable it's causing issues. Is there a way around this?
I will try changing my Caddyfile to use path matchers instead
{$PULLPREVIEW_URL} {
handle_path /* {
reverse_proxy http://client:3000
}
handle_path /api/* {
reverse_proxy http://api:8080
}
}
I know this is a Caddy thing but I'm not able to get this to work with the path matchers under one port. I think we need a way to get the PULLPREVIEW_URL
without the port
I got it to work with the above configuration and this docker-compose snippet:
# Caddy for SSL termination
# ----------------
web-proxy:
image: caddy:2
restart: unless-stopped
environment:
PULLPREVIEW_URL: ${PULLPREVIEW_URL}
ports:
- "80:80"
- "443:443"
volumes:
- $PWD/Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
I'd recommend testing this out and adding it to your docs
Hello, if you only want the host, have you tried using PULLPREVIEW_PUBLIC_DNS
? And building URLs around it if needed?
I may try that in the future, but I got it working better using a single port and path matchers.... a lot cleaner. Thanks!