OnetapInc / chromy

Chromy is a library for operating headless chrome. 🍺🍺🍺
MIT License
605 stars 41 forks source link

Host header is specified and is not an IP address or localhost. #110

Open jawadst opened 6 years ago

jawadst commented 6 years ago

When Chromy is started without a start URL on the latest Chrome unstable, Chrome sends the following error back: "Host header is specified and is not an IP address or localhost."

This seems to be a WIP change that they are introducing: https://groups.google.com/a/chromium.org/forum/#!topic/devtools-reviews/na2b4wQ3v2g

hbakhtiyor commented 6 years ago

and so what's the workaround of the issue?

zerefel commented 6 years ago

This is also an issue if you decide to run headless Chrome within a Docker container and reference it by its service name, which Docker automatically resolves to an IP address.

jawadst commented 6 years ago

@hbakhtiyor I haven't found any real workaround so far. I am running Chrome headless in a Docker container as mentioned by @zerefel and I use the yukinying/chrome-headless-browser image. For now, I have fixed the version to Chrome 65.0.3322.3 (before they introduced the change). It's not long term but it works for now.

hbakhtiyor commented 6 years ago

@jawadst how did you specify version of chrome in docker?

jawadst commented 6 years ago

@hbakhtiyor Our docker-compose is the following:

version: '3'

services:
  app:
    container_name: app
    build: .
    working_dir: /app
    volumes:
      - .:/app

  chrome:
    image: yukinying/chrome-headless-browser:65.0.3322.3
    cap_add:
      - SYS_ADMIN
    entrypoint: /usr/bin/dumb-init -- /usr/bin/google-chrome-unstable --disable-gpu --headless --disable-dev-shm-usage --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 --user-data-dir=/data --proxy-server=http://app:24000