首页 > 解决方案 > VSCode Chrome Debugger disable web security

问题描述

I'm developing a remote application which need the web security disabled on Chrome, which I have a windows shortcut that takes the following runtime argument:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -incognito --disable-web-security --user-data-dir=C:\Program

For vscode, I have the following launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "chrome",
            "request": "launch",
            "name": "web-security-disabled-chrome",
            "url": "http://localhost:8000",
            "runtimeArgs": [
                "--disable-web-security --user-data-dir=C:\\Program",
                "-incognito"
            ], 
            "webRoot": "${workspaceFolder}"
        }
    ]
}

and it doesn't disable web-security.

Failed to load resource: net::ERR_CERT_AUTHORITY_INVALID [https://my.remote.ip/restapp/...

I also tried the following:

Give vscode a new directory for user data. I saw the folder got populated, but web-security is not disabled.

Put -user-data-dir into it's own string. VSCode shows error

Cannot connect to runtime process, timeout after 10000ms -(reason: Can't find a valid target taht matches: about:blank. Available pages: ["chrome-ex...://ceimgagkkofjoalgojpkdcmhmbljbbaa/_generated_background_page.html"]).

Does anyone know if it is possible to configure Chrome debugger to run web-secruity-disabled?

标签: google-chromevisual-studio-code

解决方案


对于证书问题,您应该添加以下命令行参数:

"configurations": [
{
  "type": "chrome",
  "request": "launch",
   ...
  "runtimeArgs": ["--ignore-certificate-errors"]
}

推荐阅读