问题
I'm trying to remote debugg a chrome instance using the remote debug option in chrome:
chrome.exe --remote-debugging-port=1337
as described on google page: http://code.google.com/chrome/devtools/docs/remote-debugging.html
the problem is when i try to access it using IP it doesn't work, while testing it with localhost:1337 does work.
any idea?
回答1:
You can setup an SSH tunnel in order to debug remotely. On the source machine execute:
ssh -L 0.0.0.0:9223:localhost:9222 localhost -N
Then on the other machine point Chrome browser to http://source-machine-ip:9223
回答2:
I don't think Chrome accepts connections from outside of localhost (for security reasons). I would suggest you have to build small proxy on the same host where Chrome is.
回答3:
The easiest way of sharing your debugging session with another computer is with socat. For example, if you've enabled the remote debugging protocol on port 1337 using
chromium --remote-debugging-port=1337
Then, you can create a tunnel using socat,
socat tcp-listen:5656,fork tcp:localhost:1337
After doing this, anyone can just visit http://<YOUR_IP_OR_HOSTNAME>:5656/
and immediately use the debugger.
When you're done, press Ctrl + C to terminate socat and thus stop the tunneling.
If the previous code does not work, check whether the firewall (e.g. iptables
) is blocking access. If the firewall is OK, check whether the IP address or host name is actually correct. To see whether the traffic is correctly forwarded/tunnelled, visit http://localhost:5656/
and verify that there's a Webkit debugger instance running.
回答4:
The following worked for me when running a Chrome remote debugging host on Windows 8.
- Add an Inbound Rule to Windows Firewall
- Search for "Windows Firewall" and select the "Windows Firewall" result
- On the left of the "Windows Firewall" control panel window, click "Advanced Settings". This will open up "Windows Firewall with Advanced Security".
- In the tree view on the left, click "Inbound Rules"
- On the far right, click "New Rule..."
- Select "Port" (Click Next)
- Select TCP and set "Specific local ports" to
9222
(Click Next) - Select "Allow the connection" (Click Next)
- Choose the profile access (Domain, Private, Public) to suit your needs (Click Next)
- Give it a name like
Chrome Remote Debugging (9222)
(Click Finish)
- Follow user3445047's instructions on port forwarding:
Run Chrome on the Windows host:
chrome.exe --remote-debugging-port=9222
Set up port forwarding on the Windows host:
Open up a cmd
window. You must "Run as administrator".
Enter the following into the cmd window:
netsh
interface
portproxy
add v4tov4 listenport=9222 connectaddress=127.0.0.1
On the client, navigate to http://THE_HOST_IP_ADDRESS:9222
and you should be presented with a list of "Inspectable Pages".
回答5:
Start the headless server
chrome.exe --remote-debugging-port=9222
Set up Port forwarding on windows
netsh interface portproxy add v4tov4^ listenport=9222 listenaddress=0.0.0.0^ connectaddress=127.0.0.1 connectport=9222
回答6:
recent Chrome versions support the commandline switch "--remote-debugging-address" so the workarounds listed above should no longer be necessary.
Here the description: "Use the given address instead of the default loopback for accepting remote debugging connections. Should be used together with --remote-debugging-port. Note that the re-mote debugging protocol does not perform any authentica-tion, so exposing it too widely can be a security risk."
回答7:
You can create simple TCP proxy with netcat:
EXTERNAL_PORT=1338
CHROME_DEBUG_PORT=1337 # This is the port specified with --remote-debugging-port
nc -l -p ${EXTERNAL_PORT} -c "nc 127.0.0.1 ${CHROME_DEBUG_PORT}"
来源:https://stackoverflow.com/questions/6827310/chrome-remote-debugging-doesnt-work-with-ip