问题
I currently have multiple network alias (eth0, eht0:1, eth0:2), each having their own private ip which has its own public ip. When using remote web driver with phantomjs (ghostdriver), it always chooses the local host (See BUG https://github.com/ariya/phantomjs/issues/10269), for client argument --webdriver=ip:port, thus I cannot rely on phantomjs to pick the correct interface.
I am currently under the impression that I will have to use IPTABLES. I want to route ever instance of my java program using remote web driver to a different public ip when connecting to the phantomjs (ghostdriver) driver. Currently I can only control the port that it listens on.
Any suggestions would be greatly appreciated.
回答1:
The best way so far to resolve this was to use a reverse proxy. Use the proxy option with phantomjs to specify the proxy ip and port, and configure a reverse proxy to redirect that traffic out.
来源:https://stackoverflow.com/questions/29932658/bind-phantomjs-to-a-network-interface