29

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?

2
  • 2
    is the port open on windows? when not you have to add to the a windows firewall rules for this port! Commented Jul 26, 2011 at 9:28
  • webkit.org/blog/1620/webkit-remote-debugging Commented Aug 24, 2011 at 14:25

8 Answers 8

37

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

Sign up to request clarification or add additional context in comments.

5 Comments

Thank you! That one worked out for me just fine. I never managed to use netcat for that.
Thanks, just what I needed, a second time (referenced in Aug 15), to get two GNU/Linux boxes chatting for remote debugging.
You can also use -R flag for remote port forwarding
Its not working in latest version. Chrome is returning empty response.
@ShashwatKumar: returning HTTP 200 OK, means it is working. However newer chrome devtools is listening on ws:// instead of http://
21

The following worked for me when running a Chrome remote debugging host on Windows 8.

  1. 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)
  2. 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".

Comments

20

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.

5 Comments

because they created for mobile devices that you can debug from your desktop and not from a smartphone
What resource would be recommended to create a proxy? I imagine for most cases this is more trouble than it's worth, but I've thought this several times in the last couple of months.
Sorry, Chris, I have no recommendation here. I wrote Java from scratch for myself and you probably could also. I know that some flavor of 'nc' (netcat) utility already support proxying (not openbsd).
I could recommend Charles Web Debugging Proxy.
Solved: See my answer for complete solution on Windows without installing any third party software.
19

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.

2 Comments

I get Host header is specified and is not an IP address or localhost when trying to access it with another hostname than localhost
If your server is both accessible with IPV6 and IPV4, i would recommand using IP instead of hostname. (Didn't work for me at first since socat was running on IPV4, and chrome was trying IPV6)
11
  1. Start the headless server

    chrome.exe --remote-debugging-port=9222
    
  2. 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 
    

3 Comments

On Windows, this in conjunction with adding an Inbound Rule to Windows Firewall works well without the need to install any extra port forwarding utils. See my answer for complete instructions...
Note that the line continuation character is (^) for cmd.exe (as I've added above), but is backtick (`) for PowerShell, instead.
Chome gives an error if you try this: Host header is specified and is not an IP address or localhost.
8

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."

6 Comments

Do you know how to use this? I've tried all sorts of things and I cannot access the debug tools remotely. Is it asking for the remote clients IP? Or is it asking for a DNS name that will resolve to my machine?
@Sean256 did you figure this out? No matter what incantation I use I can't make this work..
@MarcusStade I have not. I have since resorted to creating an ssh tunnel. It must be broken.
I'm running Chrome under Docker container and adding --remote-debugging-address=0.0.0.0 to the command line allowed me to connect from outside. Easy way to test is to check the version page: localhost:9222/json/version
stackoverflow.com/questions/40538197/… States that this only works in headless mode.
|
0

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}"

Comments

0

Try changing port number That works for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.