我有一个反向代理、前端和后端容器。后端正在运行 Pyppeteer 反向代理在docker-compose.yml中以别名“servicename.localhost”设置:
networks: default: aliases: - servicename.localhost
这样我就可以 curl --insecure https://servicename.localhost 但不幸的是,同一容器上的chromium忽略了该设置,因此“servicename.localhost”解析为127.0.0.1:
curl --insecure https://servicename.localhost
pyppeter.errors.pageerror:net::err_连接在被拒绝 https://servicename.localhost/login
我怎么解决这个问题?
它看起来可能与 DNS prefetching 或 asynchronous DNS 但似乎没有命令行标志来禁用它们中的任何一个。
我尝试过但没有改变的事情:
"--host-rules='MAP servicename.localhost {}'".format(socket.gethostbyaddr('servicename.localhost')[-1][0])
pyppeteer.launch
args
"--host-resolver-rules=[same as above]
Pypeter.启动
阿尔茨海默病
我通过将TLD从“localhost”更改为“test”来解决这个问题。