Can't access host when using macvlan

I would like to use Caddy in Docker in my local network as reverse proxy. In Adguard home I set DNS rewrite: *.home.lan → 192.168.1.11. So any subdomain at *.home.lan resolves to Caddy’s IP address. I set ipv4_address, because I would like that the container shows up as a real IP on my local network.

Docker-compose:

version: "3.7"

services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - $PWD/Caddyfile:/etc/caddy/Caddyfile
      - $PWD/site:/srv
    networks:
      priv_lan:
        ipv4_address: 192.168.1.11

networks:

  # The priv_lan network is already setup, so it is an 'external' network
  priv_lan:
    external:
      name: priv_lan

Caddy config:

{
    auto_https off
    debug
}

service1.home.lan:80 {
 reverse_proxy 192.168.1.54:7878
}

service2.home.lan:80 {
  reverse_proxy 192.168.1.155:5005
}

192.168.1.11 = Caddy in Docker
192.168.1.54 = A PC on my network
192.168.1.155 = the host where Caddy in Docker is running

First reverse proxy works without any problem, 1.54 is a physical PC on my network.

There is a problem with second proxy. Accessing any service on the host (1.155, where the Caddy and other containers are hosted) is not working at all. I think this is a Docker/networking, loopback problem?

Docker network is created by:

docker network create -d macvlan 
–subnet=192.168.1.0/24 
–gateway=192.168.1.1 
-o parent=ens192 priv_lan

Caddy log (502, timeout):

caddy_1 | {"level":"error","ts":1676570117.1278238,"logger":"http.log.error","msg":"dial tcp 192.168.1.155:5000: i/o timeout","request":{"remote_ip":"192.168.1.226","remote_port":"63823","proto":"HTTP/1.1","method":"GET","host":"x.home.lan","uri":"/","headers":{"User-Agent":["curl/7.86.0"],"Accept":["*/*"]}},"duration":3.001463332,"status":502,"err_id":"03ed6wa13","err_trace":"reverseproxy.statusError (reverseproxy.go:1299)"}

I literally used your topic title as search term on the forum search, the first result was your post, the second this topic: How do I access container from different host on same network when using macvlan driver

It should cover the answer to your question.