forked from krum110487/fpProxy
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmain.go
More file actions
534 lines (477 loc) · 19.4 KB
/
main.go
File metadata and controls
534 lines (477 loc) · 19.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
package main
import (
"bytes"
"context"
"crypto/tls"
"encoding/json"
"flag"
"fmt"
"io"
"log"
"net"
"net/http"
"net/http/httptest"
"net/url"
"os"
"path"
"path/filepath"
"strconv"
"strings"
"time"
"github.com/FlashpointProject/zipfs"
"github.com/andybalholm/brotli"
"github.com/elazarl/goproxy"
)
const htmlContent = `<html><body>Intentionally Empty File</body></html>`
type ServerSettings struct {
RootPath string `json:"rootPath"`
GameDataPath string `json:"gameDataPath"`
LegacyPHPPath string `json:"legacyPHPPath"`
LegacyCGIBINPath string `json:"legacyCGIBINPath"`
LegacyHTDOCSPath string `json:"legacyHTDOCSPath"`
PhpCgiPath string `json:"phpCgiPath"`
UseInfinityServer bool `json:"useInfinityServer"`
InfinityServerURL string `json:"infinityServerURL"`
HandleLegacyRequests bool `json:"handleLegacyRequests"`
ExternalLegacyPort string `json:"externalLegacyPort"`
ProxyPort string `json:"proxyPort"`
ServerHTTPPort string `json:"serverHTTPPort"`
UseMad4FP bool `json:"useMad4FP"`
EnableHttpsProxy bool `json:"enableHttpsProxy"`
AllowCrossDomain bool `json:"allowCrossDomain"`
VerboseLogging bool `json:"verboseLogging"`
ApiPrefix string `json:"apiPrefix"`
OverridePaths []string `json:"overridePaths"`
LegacyOverridePaths []string `json:"legacyOverridePaths"`
ExternalFilePaths []string `json:"externalFilePaths"`
ExtScriptTypes []string `json:"extScriptTypes"`
ExtIndexTypes []string `json:"extIndexTypes"`
ExtGzippeddTypes []string `json:"extGzippedTypes"`
ExtMimeTypes map[string]string `json:"extMimeTypes"`
EnableHtaccess bool `json:"enableHtaccess"`
}
// ExtApplicationTypes is a map that holds the content types of different file extensions
var serverSettings ServerSettings
var proxy *goproxy.ProxyHttpServer
var cwd string
func initServer() {
// Get the CWD of this application
exe, err := os.Executable()
if err != nil {
panic(err)
}
cwd = filepath.Dir(exe)
// Load the content types from the JSON file
data, err := os.ReadFile(filepath.Join(cwd, "proxySettings.json"))
if err != nil {
panic(err)
}
// Unmarshal the JSON data into a Config struct
err = json.Unmarshal(data, &serverSettings)
if err != nil {
panic(err)
}
// Get all of the parameters passed in
// TODO: Figure out a way to (partially?) automate everything that's going on below
// TODO: Improve descriptions
rootPath := flag.String("rootPath", serverSettings.RootPath, "The path that other relative paths use as a base")
gameDataPath := flag.String("gameRootPath", serverSettings.GameDataPath, "This is the path where to find the zips")
legacyPHPPath := flag.String("legacyPHPPath", serverSettings.LegacyPHPPath, "This is the path for PHP")
legacyCGIBINPath := flag.String("legacyCGIBINPath", serverSettings.LegacyCGIBINPath, "This is the path for CGI-BIN")
legacyHTDOCSPath := flag.String("legacyHTDOCSPath", serverSettings.LegacyHTDOCSPath, "This is the path for HTDOCS")
phpCgiPath := flag.String("phpCgiPath", serverSettings.PhpCgiPath, "Path to PHP CGI executable")
useInfinityServer := flag.Bool("useInfinityServer", serverSettings.UseInfinityServer, "Whether to use the infinity server or not")
infinityServerURL := flag.String("infinityServerURL", serverSettings.InfinityServerURL, "The URL of the infinity server")
handleLegacyRequests := flag.Bool("handleLegacyRequests", serverSettings.HandleLegacyRequests, "Whether to handle legacy requests internally (true) or externally (false)")
externalLegacyPort := flag.String("externalLegacyPort", serverSettings.ExternalLegacyPort, "The port that the external legacy server is running on (if handling legacy is disabled).")
proxyPort := flag.String("proxyPort", serverSettings.ProxyPort, "proxy listen port")
serverHttpPort := flag.String("serverHttpPort", serverSettings.ServerHTTPPort, "zip server http listen port")
useMad4FP := flag.Bool("UseMad4FP", serverSettings.UseMad4FP, "flag to turn on/off Mad4FP.")
enableHttpsProxy := flag.Bool("enableHttpsProxy", serverSettings.EnableHttpsProxy, "Whether to enable HTTPS proxying or not")
allowCrossDomain := flag.Bool("allowCrossDomain", serverSettings.AllowCrossDomain, "Whether to allow cross-domain requests")
verboseLogging := flag.Bool("verboseLogging", serverSettings.VerboseLogging, "should every proxy request be logged to stdout")
apiPrefix := flag.String("apiPrefix", serverSettings.ApiPrefix, "apiPrefix is used to prefix any API call.")
enableHtaccess := flag.Bool("enableHtaccess", serverSettings.EnableHtaccess, "Enables GameZIP games to follow basic htaccess rewrite files")
flag.Parse()
// Apply all of the flags to the settings
serverSettings.RootPath, err = filepath.Abs(strings.Trim(*rootPath, "\""))
if err != nil {
fmt.Println("Failed to get absolute root path")
panic(err)
}
serverSettings.GameDataPath, err = filepath.Abs(path.Join(serverSettings.RootPath, strings.Trim(*gameDataPath, "\"")))
if err != nil {
fmt.Println("Failed to get absolute game data path")
panic(err)
}
serverSettings.LegacyPHPPath, err = filepath.Abs(path.Join(serverSettings.RootPath, strings.Trim(*legacyPHPPath, "\"")))
if err != nil {
fmt.Println("Failed to get absolute PHP path")
panic(err)
}
serverSettings.LegacyCGIBINPath, err = filepath.Abs(path.Join(serverSettings.RootPath, strings.Trim(*legacyCGIBINPath, "\"")))
if err != nil {
fmt.Println("Failed to get absolute cgi-bin path")
panic(err)
}
serverSettings.LegacyHTDOCSPath, err = filepath.Abs(path.Join(serverSettings.RootPath, strings.Trim(*legacyHTDOCSPath, "\"")))
if err != nil {
fmt.Println("Failed to get absolute htdocs path")
panic(err)
}
serverSettings.PhpCgiPath, err = filepath.Abs(path.Join(serverSettings.RootPath, strings.Trim(*phpCgiPath, "\"")))
if err != nil {
fmt.Println("Failed to get absolute PHP-CGI path")
panic(err)
}
serverSettings.UseInfinityServer = *useInfinityServer
serverSettings.InfinityServerURL = *infinityServerURL
serverSettings.HandleLegacyRequests = *handleLegacyRequests
serverSettings.ExternalLegacyPort = *externalLegacyPort
serverSettings.ProxyPort = *proxyPort
serverSettings.ServerHTTPPort = *serverHttpPort
serverSettings.UseMad4FP = *useMad4FP
serverSettings.EnableHttpsProxy = *enableHttpsProxy
serverSettings.AllowCrossDomain = *allowCrossDomain
serverSettings.VerboseLogging = *verboseLogging
serverSettings.ApiPrefix = *apiPrefix
serverSettings.EnableHtaccess = *enableHtaccess
// Print out all path settings
fmt.Println("Root Path:", serverSettings.RootPath)
fmt.Println("Game Data Path:", serverSettings.GameDataPath)
fmt.Println("Legacy PHP Path:", serverSettings.LegacyPHPPath)
fmt.Println("Legacy CGI-BIN Path:", serverSettings.LegacyCGIBINPath)
fmt.Println("Legacy HTDOCS Path:", serverSettings.LegacyHTDOCSPath)
fmt.Println("PHP-CGI Path:", serverSettings.PhpCgiPath)
fmt.Println("Htaccess Enabled:", serverSettings.EnableHtaccess)
// Setup the proxy
proxy = goproxy.NewProxyHttpServer()
proxy.Verbose = serverSettings.VerboseLogging
fmt.Println("Proxy Server started on port", serverSettings.ProxyPort)
fmt.Println("Zip Server started on port", serverSettings.ServerHTTPPort)
}
func setContentType(r *http.Request, resp *http.Response) {
if r == nil || resp == nil {
return
}
currentMime := resp.Header.Get("Content-Type")
fnameHeader := resp.Header.Get("ZIPSVR_FILENAME")
fname := strings.TrimSpace(r.URL.Path)
rext := strings.ToLower(filepath.Ext(fnameHeader))
ext := strings.ToLower(filepath.Ext(fname))
mime := ""
if currentMime == "text/html; charset=utf-8" {
currentMime = "text/html"
resp.Header.Set("Content-Type", currentMime)
}
if (ext == ".php" || rext == ".php") && currentMime != "" {
// Keep content types set by php script if available
return
}
resp.Header.Del("Content-Type")
// If the request already has an extension, fetch the mime via extension
if ext != "" && len(ext) > 1 {
e := ext[1:]
mime = serverSettings.ExtMimeTypes[e]
// Check if gzipped
for _, element := range serverSettings.ExtGzippeddTypes {
if element == e {
resp.Header.Set("Content-Encoding", "gzip")
break // String found, no need to continue iterating
}
}
// Check if brotli compressed
if e == "br" {
resp.Header.Set("Content-Encoding", "br")
// Try and use the previous ending for content type, if exists
prevExt := filepath.Ext(strings.TrimSuffix(strings.ToLower(fname), "."+e))
if prevExt != "" {
prevMime := serverSettings.ExtMimeTypes[prevExt[1:]]
if prevMime != "" {
mime = prevMime
}
}
}
}
// Sometimes we're given the filename via a header instead, check that too
if mime == "" && rext != "" && len(rext) > 1 {
e := rext[1:]
mime = serverSettings.ExtMimeTypes[e]
// Check if gzipped
for _, element := range serverSettings.ExtGzippeddTypes {
if element == e {
resp.Header.Set("Content-Encoding", "gzip")
break // String found, no need to continue iterating
}
}
// Check if brotli compressed
if e == "br" {
resp.Header.Set("Content-Encoding", "br")
// Try and use the previous ending for content type, if exists
prevExt := filepath.Ext(strings.TrimSuffix(strings.ToLower(fnameHeader), "."+e))
if prevExt != "" {
prevMime := serverSettings.ExtMimeTypes[prevExt[1:]]
if prevMime != "" {
mime = prevMime
}
}
}
}
// Set content type header
if mime != "" {
resp.Header.Del("Content-Type")
resp.Header.Set("Content-Type", mime)
}
}
func getProxyResp(r *http.Request, contents []byte) (*http.Response, error) {
// Copy the original request
gamezipRequest := &http.Request{
Method: r.Method,
URL: &url.URL{
Scheme: "http",
Host: "127.0.0.1:" + serverSettings.ServerHTTPPort,
Path: "content/" + r.URL.Host + r.URL.Path,
RawQuery: r.URL.RawQuery,
},
Header: r.Header,
Body: nil,
}
gamezipRequest.Body = io.NopCloser(bytes.NewReader(contents))
// Make the request to the zip server.
client := &http.Client{
// Don't follow redirects, let the client we've serving do it instead
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
proxyReq, err := http.NewRequest(gamezipRequest.Method, gamezipRequest.URL.String(), gamezipRequest.Body)
if err != nil {
fmt.Printf("UNHANDLED GAMEZIP ERROR: %s\n", err)
}
proxyReq.Header = gamezipRequest.Header
proxyResp, err := client.Do(proxyReq)
if err != nil {
return nil, err
}
if proxyResp.StatusCode >= 500 {
return proxyResp, nil
}
// Prevent htdocs loading
// Intercept if we're serving /content/www.mochiads.com/static/lib/services/services.swf and it's smaller than 10kb (probably parked page)
if r.URL.Host == "www.mochiads.com" && strings.HasPrefix(r.URL.Path, "/static/lib/services/services.swf") {
resRecorder := httptest.NewRecorder()
resRecorder.Header().Set("Content-Type", "text/html")
resRecorder.Header().Set("Content-Length", strconv.Itoa(len(htmlContent)))
resRecorder.Header().Set("ZIPSVR_FILENAME", "/empty.html")
resRecorder.WriteHeader(http.StatusOK)
resRecorder.Write([]byte(htmlContent))
return resRecorder.Result(), nil
}
// Check Legacy
if proxyResp.StatusCode >= 400 {
// Copy the original request
legacyRequest := &http.Request{
Method: r.Method,
URL: &url.URL{
Scheme: "http",
Host: r.URL.Host,
Path: r.URL.Path,
RawQuery: r.URL.RawQuery,
},
Header: r.Header,
Body: nil,
}
// Copy in a new body reader
legacyRequest.Body = io.NopCloser(bytes.NewReader(contents))
// Choose which legacy method we're using
if serverSettings.HandleLegacyRequests {
// If internal, skip actual networking
resRecorder := httptest.NewRecorder()
ServeLegacy(resRecorder, legacyRequest)
proxyResp = resRecorder.Result()
} else {
// Set the Proxy URL and apply it to the Transpor layer so that the request respects the proxy.
proxyURL, _ := url.Parse("http://127.0.0.1:" + serverSettings.ExternalLegacyPort)
proxy := http.ProxyURL(proxyURL)
transport := &http.Transport{Proxy: proxy}
// A custom Dialer is required for the "localflash" urls, instead of using the DNS, we use this.
transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
//Set Dialer timeout and keepalive to 30 seconds and force the address to localhost.
dialer := &net.Dialer{Timeout: 30 * time.Second, KeepAlive: 30 * time.Second}
addr = "127.0.0.1:" + serverSettings.ExternalLegacyPort
return dialer.DialContext(ctx, network, addr)
}
// Make the request with the custom transport
client := &http.Client{Transport: transport, Timeout: 300 * time.Second}
legacyResp, err := client.Do(legacyRequest)
// An error occured, log it for debug purposes
if err == nil {
fmt.Printf("\tServing from External Legacy...\n")
proxyResp = legacyResp
} else {
fmt.Printf("UNHANDLED EXTERNAL LEGACY ERROR: %s\n", err)
return nil, err
}
}
}
return proxyResp, nil
}
func handleRequest(r *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
// Remove port from host if exists (old apps don't clean it before sending requests?)
r.URL.Host = strings.Split(r.URL.Host, ":")[0]
r.Header.Del("If-Modified-Since")
// Clone the body into both requests by reading and making 2 new readers
contents, _ := io.ReadAll(r.Body)
proxyResp, err := getProxyResp(r, contents)
if err != nil {
fmt.Printf("UNHANDLED GAMEZIP SERVER ERROR: %s\n", err)
return r, nil
}
if proxyResp.StatusCode >= 500 {
fmt.Println("Gamezip Server Error: ", proxyResp.StatusCode)
return r, proxyResp
}
// Not found
if proxyResp.StatusCode == 404 {
// If it's a Brotli file request, check for an uncompressed file instead
if strings.HasSuffix(r.URL.Path, ".br") {
// Create a modified request with the path without .br extension
unbrotliRequest := *r // Create a copy of the original request
unbrotliRequest.URL = &url.URL{} // Create a new URL to avoid modifying the original
*unbrotliRequest.URL = *r.URL // Copy all URL fields
// Remove the .br extension from the path
unbrotliRequest.URL.Path = strings.TrimSuffix(r.URL.Path, ".br")
// Use the existing getProxyResp function to make the request
unbrotliResp, err := getProxyResp(&unbrotliRequest, contents)
if err != nil {
fmt.Printf("Error requesting uncompressed file: %s\n", err)
return r, proxyResp
}
// If we found the uncompressed version, use it
if unbrotliResp.StatusCode == 200 {
fmt.Printf("Found uncompressed version of %s\n", r.URL.Path)
return r, unbrotliResp
}
// Close the response if we're not using it
unbrotliResp.Body.Close()
}
}
if proxyResp.StatusCode < 400 {
setContentType(r, proxyResp)
}
fmt.Printf("Response: Status=%d, URL=%s\n",
proxyResp.StatusCode,
r.URL.String())
// Check if content is brotli-encoded and decode it so we can respond to HTTP requests
if proxyResp.StatusCode < 400 && strings.ToLower(proxyResp.Header.Get("Content-Encoding")) == "br" {
// Read the brotli-encoded body
brBody, err := io.ReadAll(proxyResp.Body)
if err != nil {
fmt.Printf("Error reading brotli-encoded body: %s\n", err)
} else {
// Close the original body
proxyResp.Body.Close()
// Decode the brotli content
reader := brotli.NewReader(bytes.NewReader(brBody))
decodedBody, err := io.ReadAll(reader)
if err != nil {
fmt.Printf("Error decoding brotli content: %s\n", err)
// Restore original body if decoding fails
proxyResp.Body = io.NopCloser(bytes.NewReader(brBody))
} else {
// Replace the body with decoded content
proxyResp.Body = io.NopCloser(bytes.NewReader(decodedBody))
// Remove the Content-Encoding header
proxyResp.Header.Del("Content-Encoding")
// Update Content-Length if it exists
if proxyResp.ContentLength > 0 {
proxyResp.ContentLength = int64(len(decodedBody))
proxyResp.Header.Set("Content-Length", fmt.Sprintf("%d", len(decodedBody)))
}
fmt.Println("Decoded brotli content for HTTP request")
}
}
}
// Add extra headers
proxyResp.Header.Set("Access-Control-Allow-Headers", "*")
proxyResp.Header.Set("Access-Control-Allow-Methods", "*")
proxyResp.Header.Set("Access-Control-Allow-Origin", "*")
// Keep Alive
if strings.ToLower(r.Header.Get("Connection")) == "keep-alive" {
proxyResp.Header.Set("Connection", "Keep-Alive")
proxyResp.Header.Set("Keep-Alive", "timeout=5; max=100")
}
return r, proxyResp
}
func main() {
initServer()
// To create CA cert, refer to https://wiki.mozilla.org/SecurityEngineering/x509Certs#Self_Signed_Certs
// Replace CA in GoProxy
certData := []byte(`-----BEGIN CERTIFICATE-----
MIICJDCCAcsCFFCWJV/hBHpY18k/14yUbDA6V/TTMAoGCCqGSM49BAMCMIGTMQsw
CQYDVQQGEwJVUzETMBEGA1UECAwKU29tZS1TdGF0ZTEoMCYGA1UECgwfRmxhc2hw
b2ludCBQcm94eSBVbnRydXN0ZWQgTUlUTTEoMCYGA1UECwwfRmxhc2hwb2ludCBQ
cm94eSBVbnRydXN0ZWQgTUlUTTEbMBkGA1UEAwwSZnBwcm94eS5sb2NhbC5zaXRl
MCAXDTIzMTAxNDEzNTQxNVoYDzIxMjMwOTIwMTM1NDE1WjCBkzELMAkGA1UEBhMC
VVMxEzARBgNVBAgMClNvbWUtU3RhdGUxKDAmBgNVBAoMH0ZsYXNocG9pbnQgUHJv
eHkgVW50cnVzdGVkIE1JVE0xKDAmBgNVBAsMH0ZsYXNocG9pbnQgUHJveHkgVW50
cnVzdGVkIE1JVE0xGzAZBgNVBAMMEmZwcHJveHkubG9jYWwuc2l0ZTBZMBMGByqG
SM49AgEGCCqGSM49AwEHA0IABDOkMb4Fb+waYfEXg5OszAyjNqcp8PLTqSC2fcfC
gX3Wqgvq4Vf46F4FViDKyo+E+6fOm3MauI3Vg2FGKUXf9jowCgYIKoZIzj0EAwID
RwAwRAIgHyjrkkCwuOQm5JO5SKeH3Om8dQm6m6a+1k5max2RqakCICQRzrm0ERo4
siAXSthMrOdDignP/cM10AcBe/J00Vw8
-----END CERTIFICATE-----`)
keyData := []byte(`-----BEGIN EC PARAMETERS-----
BggqhkjOPQMBBw==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIGfj1mtowe1WiAMA3mK1VjgXV1lgUkliUxnk6lr5y/g5oAoGCCqGSM49
AwEHoUQDQgAEM6QxvgVv7Bph8ReDk6zMDKM2pynw8tOpILZ9x8KBfdaqC+rhV/jo
XgVWIMrKj4T7p86bcxq4jdWDYUYpRd/2Og==
-----END EC PRIVATE KEY-----`)
cert, err := tls.X509KeyPair(certData, keyData)
if err != nil {
panic(err)
}
goproxy.MitmConnect.TLSConfig = goproxy.TLSConfigFromCA(&cert)
// Handle HTTPS requests (DOES NOT HANDLE HTTP)
if serverSettings.EnableHttpsProxy {
proxy.OnRequest().HandleConnect(goproxy.AlwaysMitm)
} else {
proxy.OnRequest().HandleConnect(goproxy.AlwaysReject)
}
proxy.OnRequest().HijackConnect(func(req *http.Request, client net.Conn, ctx *goproxy.ProxyCtx) {
_, resp := handleRequest(req, ctx)
err := resp.Write(client)
if err != nil {
fmt.Printf("Error writing response to client: %s\n", err)
}
client.Close()
})
// Handle HTTP requests (DOES NOT HANDLE HTTPS)
proxy.OnRequest().DoFunc(func(r *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
return handleRequest(r, ctx)
})
// Start ZIP server
go func() {
//TODO: Update these to be modifiable in the properties json.
//TODO: Also update the "fpProxy/api/" to be in the properties json.
log.Fatal(http.ListenAndServe("127.0.0.1:"+serverSettings.ServerHTTPPort,
zipfs.EmptyFileServer(
serverSettings.ApiPrefix,
"",
serverSettings.VerboseLogging,
serverSettings.ExtIndexTypes,
serverSettings.GameDataPath,
serverSettings.PhpCgiPath,
serverSettings.ExtMimeTypes,
serverSettings.ExtScriptTypes,
serverSettings.OverridePaths,
serverSettings.LegacyHTDOCSPath,
serverSettings.EnableHtaccess,
),
))
}()
// Start proxy server
log.Fatal(http.ListenAndServe("127.0.0.1:"+serverSettings.ProxyPort, http.AllowQuerySemicolons(proxy)))
}