@@ -48,6 +48,7 @@ type ServerSettings struct {
4848 LegacyOverridePaths []string `json:"legacyOverridePaths"`
4949 UseInfinityServer bool `json:"useInfinityServer"`
5050 InfinityServerURL string `json:"infinityServerURL"`
51+ EnableHttpsProxy bool `json:"enableHttpsProxy"`
5152}
5253
5354// ExtApplicationTypes is a map that holds the content types of different file extensions
@@ -92,6 +93,7 @@ func initServer() {
9293 infinityServerURL := flag .String ("infinityServerURL" , serverSettings .InfinityServerURL , "The URL of the infinity server" )
9394 legacyCGIBINPath := flag .String ("legacyCGIBINPath" , serverSettings .LegacyCGIBINPath , "This is the path for CGI-BIN" )
9495 handleLegacyRequests := flag .Bool ("handleLegacyRequests" , false , "Whether to handle legacy requests internally (true) or externally (false)" )
96+ enableHttpsProxy := flag .Bool ("enableHttpsProxy" , false , "Whether to enable HTTPS proxying or not" )
9597
9698 flag .Parse ()
9799
@@ -102,6 +104,7 @@ func initServer() {
102104 fmt .Printf ("Failed to get absolute game root path" )
103105 return
104106 }
107+ serverSettings .EnableHttpsProxy = * enableHttpsProxy
105108 serverSettings .ProxyPort = strconv .Itoa (* proxyPort )
106109 serverSettings .ServerHTTPPort = strconv .Itoa (* serverHTTPPort )
107110 serverSettings .ApiPrefix = * apiPrefix
@@ -332,7 +335,11 @@ XgVWIMrKj4T7p86bcxq4jdWDYUYpRd/2Og==
332335 goproxy .MitmConnect .TLSConfig = goproxy .TLSConfigFromCA (& cert )
333336
334337 // Handle HTTPS requests (DOES NOT HANDLE HTTP)
335- proxy .OnRequest ().HandleConnect (goproxy .AlwaysReject )
338+ if serverSettings .EnableHttpsProxy {
339+ proxy .OnRequest ().HandleConnect (goproxy .AlwaysMitm )
340+ } else {
341+ proxy .OnRequest ().HandleConnect (goproxy .AlwaysReject )
342+ }
336343 proxy .OnRequest ().HijackConnect (func (req * http.Request , client net.Conn , ctx * goproxy.ProxyCtx ) {
337344 _ , resp := handleRequest (req , ctx )
338345 err := resp .Write (client )
0 commit comments