Chrome remote debugging doesn't work with IP

前端 未结 7 833
长发绾君心
长发绾君心 2020-12-04 16:54

I\'m trying to remote debugg a chrome instance using the remote debug option in chrome:

chrome.exe --remote-debugging-port=1337

as describe

相关标签:
7条回答
  • 2020-12-04 17:20

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

    0 讨论(0)
  • 2020-12-04 17:21

    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}"
    
    0 讨论(0)
  • 2020-12-04 17:24
    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 
      
    0 讨论(0)
  • 2020-12-04 17:32

    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

    0 讨论(0)
  • 2020-12-04 17:38

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

    0 讨论(0)
  • 2020-12-04 17:39

    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.

    0 讨论(0)
提交回复
热议问题