Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Can not resolve domain name set by extra_hosts: #1446

Open
2 tasks done
OrvilleQ opened this issue Sep 3, 2024 · 1 comment
Open
2 tasks done

[BUG] Can not resolve domain name set by extra_hosts: #1446

OrvilleQ opened this issue Sep 3, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@OrvilleQ
Copy link

OrvilleQ commented Sep 3, 2024

What happened?

I install Bunkerweb with Docker compose, with extra_hosts: - host.docker.internal:host-gateway which mapped IP address of the host 172.17.0.1 to host.docker.internal inside container's /etc/hosts.

Since I wanna proxy a server from the host, I add a service with Reverse proxy host http://host.docker.internal:19999

image

But I got 502 Bad Gateway when access the website, and the log says 2024/09/03 15:41:30 [error] 2857#2857: *2169 host.docker.internal could not be resolved (3: Host not found),

How to reproduce?

  1. install Bunkerweb using Docker compose, with extra_hosts: - host.docker.internal:host-gateway
  2. create a service which reverse proxying http://host.docker.internal:port
  3. access the domain

Configuration file(s) (yaml or .env)

#version: "3.5"

services:
  bunkerweb:
    image: bunkerity/bunkerweb:1.5.9
    ports:
      - 80:8080
      - 443:8443
    labels:
      - "bunkerweb.INSTANCE=yes"
    environment:
      - SERVER_NAME=FSN00
      - DATABASE_URI=postgresql://bunkerweb:[email protected]:5432/bunkerweb
      - AUTOCONF_MODE=yes
      - MULTISITE=yes
      - API_WHITELIST_IP=127.0.0.0/8 10.25.0.0/24
    volumes:
      - /var/lib/bunkerweb/certs:/var/lib/certs
    networks:
      - bw-universe
      - bw-services
    extra_hosts:
      - host.docker.internal:host-gateway

  bw-autoconf:
    image: bunkerity/bunkerweb-autoconf:1.5.9
    depends_on:
      - bunkerweb
      - bw-docker
    environment:
      - DATABASE_URI=postgresql://bunkerweb:[email protected]:5432/bunkerweb
      - AUTOCONF_MODE=yes
      - DOCKER_HOST=tcp://bw-docker:2375
    networks:
      - bw-universe
      - bw-docker
    extra_hosts:
      - host.docker.internal:host-gateway

  bw-scheduler:
    image: bunkerity/bunkerweb-scheduler:1.5.9
    depends_on:
      - bunkerweb
      - bw-docker
    environment:
      - DATABASE_URI=postgresql://bunkerweb:[email protected]:5432/bunkerweb
      - DOCKER_HOST=tcp://bw-docker:2375
      - AUTOCONF_MODE=yes
    networks:
      - bw-universe
      - bw-docker
    extra_hosts:
      - host.docker.internal:host-gateway

  bw-docker:
    image: tecnativa/docker-socket-proxy:nightly
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - CONTAINERS=1
      - LOG_LEVEL=warning
    networks:
      - bw-docker

  bw-ui:
    image: bunkerity/bunkerweb-ui:1.5.9
    networks:
      bw-docker:
      bw-universe:
        aliases:
          - bw-ui
    environment:
      - DATABASE_URI=postgresql://bunkerweb:[email protected]:5432/bunkerweb
      - DOCKER_HOST=tcp://bw-docker:2375
      - AUTOCONF_MODE=yes
    labels:
      - "bunkerweb.SERVER_NAME=xxxxxxxxxxxxxxx"
      - "bunkerweb.USE_UI=yes"
      - "bunkerweb.USE_REVERSE_PROXY=yes"
      - "bunkerweb.REVERSE_PROXY_URL=/xxxxxxxxxxxxxxx"
      - "bunkerweb.REVERSE_PROXY_HOST=http://bw-ui:7000"
      - "bunkerweb.INTERCEPTED_ERROR_CODES=400 404 405 413 429 500 501 502 503 504"
      - "bunkerweb.MAX_CLIENT_SIZE=50m"
      - "bunkerweb.AUTO_LETS_ENCRYPT=yes"
    extra_hosts:
      - host.docker.internal:host-gateway

networks:
  bw-universe:
    name: bw-universe
    ipam:
      driver: default
      config:
        - subnet: 10.25.0.0/24
  bw-services:
    name: bw-services
  bw-docker:
    name: bw-docker

Relevant log output

2024/09/03 15:41:30 [error] 2857#2857: *2169 host.docker.internal could not be resolved (3: Host not found), client: 199.xxx.xxx.xxx, server: fsn00.xxx.xxx.xxx, request: "GET / HTTP/2.0", host: "fsn00.xxx.xxx.xxx"

BunkerWeb version

1.5.9

What integration are you using?

Docker

Linux distribution (if applicable)

Rockylinux

Removed private data

  • I have removed all private data from the configuration file and the logs

Code of Conduct

  • I agree to follow this project's Code of Conduct
@OrvilleQ OrvilleQ added the bug Something isn't working label Sep 3, 2024
@TheophileDiot
Copy link
Member

Hi, sorry for the (very) late response and thank you for opening this issue. We'll have a look into is asap and let you know

@TheophileDiot TheophileDiot self-assigned this Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants