I tried to run a sample of Vue.js on Vue.js+Electron in a Proxy environment, but if I specify Vue.js in CND, I get a connection error.
If you open the Html file directly, you can run it without any problems, so I think you need to set Proxy in the Chromium of Electron, but I'm having trouble because I don't know how to set Proxy.
Supported Chrome command line switches
Based on the above site, I set it up as follows, but net::ERR_TUNNEL_CONNECTION_FAILED failed.
'use strict';
// Modules that control applications
var app=require('app');
// Chrome command line switches
// app.commandLine.appendSwitch('proxy-pac-url', '<PAC Url>');
app.commandLine.appendSwitch('proxy-server', '<Prosy>:<Port>');
I think it's probably because I didn't set the authentication information (ID, PASS), but
The authentication dialog is not displayed, so please let me know if there is any other way to set it up.
There are two things.
If you write the wrapper below, you don't need to play with the code.
electron.--proxy-server=proxy-server:port
If you have an environment where you can build Golang, you can build and run the following:
package main
import(
"flag"
"github.com/elazarl/goproxy"
"log"
"net/http"
)
funcmain(){
verbose: = flag.Bool("v", false, "should every proxy request be logged to stdout")
addr:=flag.String("addr", ":8080", "proxy listen address")
flag.Parse()
proxy: =goproxy.NewProxyHttpServer()
proxy.Verbose=*verbose
log.Fatal(http.ListenAndServe(*addr,proxy))
}
Golang's http client is
http_proxy=http://USER:PASSWORD@proxy-server:port
It recognizes the environment variable, so
electron=>local-proxy (no authentication)=>actual-proxy (with authentication)=>Internet
Electron will be able to connect to the network without authentication.
© 2024 OneMinuteCode. All rights reserved.