I've got a reverse proxy, frontend and backend container. The backend is running Pyppeteer and the reverse proxy is set up with an alias "servicename.localhost" in docker-compose.yml:
networks:
default:
aliases:
- servicename.localhost
This way I'm able to curl --insecure https://servicename.localhost
from the backend container, but unfortunately it seems Chromium on the same container ignores that setting and so "servicename.localhost" resolves to 127.0.0.1:
pyppeteer.errors.PageError: net::ERR_CONNECTION_REFUSED at https://servicename.localhost/login
How can I work around this?
It looks like it may be related to DNS prefetching or asynchronous DNS, but there doesn't seem to be a command line flag to disable either of them anymore.
Things I've tried which didn't change anything:
- Adding
"--host-rules='MAP servicename.localhost {}'".format(socket.gethostbyaddr('servicename.localhost')[-1][0])
to thepyppeteer.launch
args
list parameter. - Adding
"--host-resolver-rules=[same as above]
to thepyppeteer.launch
args
list parameter.