aeleos / cloudflared

Cloudflare Tunnel Instructions and Template for Unraid
171 stars 21 forks source link

Provide localhost or container name as reverse proxy IP? #26

Open DivineDominion opened 2 years ago

DivineDominion commented 2 years ago

In the YAML config file, I get everything to work with a reverse proxy if I replace REVERSEPROXYIP:PORT with e.g. 192.168.xxx.yyy:443, which is the IP of the Unraid server. I'm using SWAG to manage the reverse proxy, and it responds to port 80 and 443 instead of the Unraid Web GUI.

Is there a way to get this to work with localhost or 0.0.0.0? I believe the problem is that localhost inside the container means something else, but I'm not very versed with the Docker and Unraid network settings.

image

DivineDominion commented 2 years ago

I figured this out by accident when I wrote the issue. Classic rubberducking :)

So localhost would point to the cloudflared container itself, that wouldn't work.

The 172.19.*.* IP of the reverse proxy is in an IPv6 NAT subnetwork, though.

Turns out I could put the cloudflared container into the proxyv6 network and then use the container name

ingress
  - service: https://swag:443
    originRequest:
      originServerName: MY_DOMAIN_HERE

That's forwarding quite well!