Closed shoutmarble closed 10 months ago
Caddy supports reading Proxy protocol.
In your case, you expect caddy to write it. I think proxy protocol is only for layer 4 proxies, for layer 4 proxies you need this plugin https://github.com/mholt/caddy-l4, and its documentation states that it supports proxy protocol. It should work.
Thank you for your help.
I'm out of my depth on this I need to understand the basics of Haproxy.
I figure I should be able to forward my Haproxy "Host" IP to my Guest "Whoami" instances...
I'm not able to do this yet...but, this is my thinking...
haproxy.yml
version: "3.8"
networks:
haproxy-net:
external: true
services:
haproxy:
image: haproxy
container_name: haproxy
ports:
- "80:80"
volumes:
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
haproxy.cfg
# global
# maxconn 5000
defaults
mode http
timeout connect 10s
timeout client 30s
timeout server 30s
default-server init-addr none
resolvers docker_resolver
nameserver dns 127.0.0.11:53
resolve_retries 10
frontend http-in
bind *:80
acl host_main hdr(host) -i landingdev.online
acl host_main hdr(host) -i www.landingdev.online
acl path_api path_beg -i /api
acl host_sub hdr(host) -i sub.landingdev.online
use_backend main-api if host_main path_api
use_backend main if host_main
use_backend sub if host_sub
backend main
server main main:8000 check resolvers docker_resolver
backend main-api
server main-api main-api:8000 check resolvers docker_resolver
backend sub
server sub sub:8000 check resolvers docker_resolver
whoami.yml
version: "3.8"
networks:
haproxy-net:
external: true
services:
whoami:
image: "traefik/whoami"
container_name: "whoami"
ports:
- "80:80"
networks:
- haproxy-net
http://www.landingdev.online
Hostname: 6540ab5070eb
IP: 127.0.0.1
IP: 172.31.0.2
RemoteAddr: xx.xx.xx.xx:63153
GET / HTTP/1.1
Host: test.landingdev.online
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Upgrade-Insecure-Requests: 1
I have an Email server running in Docker that uses HAProxy.
Would I be able to use CDP to pass the real IP through Proxy Protocol to my proxied Email server?
Caddy Documentation