简体   繁体   English

企业代理背后的 VSCode WebViewPanel

[英]VSCode WebViewPanel behind corporate proxy

I am using the "C4 DSL Extension" of VSCode to show previews of my architecture diagrams.我正在使用 VSCode 的“C4 DSL 扩展”来显示我的架构图的预览。 The previews are rendered through the WebviewPanel.预览通过 WebviewPanel 呈现。 The source code can be found here: https://gitlab.com/systemticks/c4-grammar/-/blob/master/extension/src/c4-structurizr-preview.ts源代码可以在这里找到: https://gitlab.com/systemticks/c4-grammar/-/blob/master/extension/src/c4-structurizr-preview.ts

It works through a direct connection, but once connected with my corporate network, all requests have to pass through a proxy.它通过直接连接工作,但一旦连接到我的公司网络,所有请求都必须通过代理。 VSCode itself handles proxies through the http_proxy and https_proxy variables. VSCode 本身通过 http_proxy 和 https_proxy 变量处理代理。 However, the WebviewPanel does not seem to take those settings.但是,WebviewPanel 似乎没有采用这些设置。

The following figure shows an excerpt of the console.下图显示了控制台的摘录。 You can see, that the request to query the "structurizr-embed.js" failed.您可以看到,查询“structurizr-embed.js”的请求失败。 在此处输入图像描述

Is this behavior intended?这种行为是有意的吗? I could not find a setting in VSCode to enable WebviewPanel to request via proxy.我在 VSCode 中找不到允许 WebviewPanel 通过代理请求的设置。

Note: I am using the Linux version of VSCode.注意:我使用的是 Linux 版本的 VSCode。

I found a solution by setting the http.proxy variable in VSCode.我通过在 VSCode 中设置http.proxy变量找到了解决方案。 We are using authentication for proxies and previously I exported the http_proxy environment variable in the form of http_proxy=http://<username>:<password>@<host>:<port> .我们正在对代理使用身份验证,之前我以http_proxy=http://<username>:<password>@<host>:<port>的形式导出了http_proxy环境变量。

However, VSCode expects this variable without credentials: http_proxy=http://<host>:<port> .但是,VSCode 期望这个变量没有凭据: http_proxy=http://<host>:<port> Now I don't understand where it talks the credentials from, but it works.现在我不明白它从哪里谈论凭据,但它可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM