1
.gitignore
vendored
1
.gitignore
vendored
@@ -87,7 +87,6 @@ node_modules/**
|
|||||||
!.gitignore
|
!.gitignore
|
||||||
!version
|
!version
|
||||||
!out.jsonl
|
!out.jsonl
|
||||||
!Dockerfile*
|
|
||||||
# ...even if they are in subdirectories
|
# ...even if they are in subdirectories
|
||||||
!*/
|
!*/
|
||||||
/blocklist.json
|
/blocklist.json
|
||||||
|
|||||||
16
main.go
16
main.go
@@ -478,14 +478,6 @@ func setProxy(mapping map[string]string) (http.Handler, error) {
|
|||||||
rp := newSingleHostReverseProxy(u)
|
rp := newSingleHostReverseProxy(u)
|
||||||
rp.ErrorLog = log2.New(io.Discard, "", 0)
|
rp.ErrorLog = log2.New(io.Discard, "", 0)
|
||||||
rp.BufferPool = bufPool{}
|
rp.BufferPool = bufPool{}
|
||||||
rp.ModifyResponse = func(resp *http.Response) error {
|
|
||||||
// Add CORS headers to all proxied responses
|
|
||||||
resp.Header.Set("Access-Control-Allow-Origin", "*")
|
|
||||||
resp.Header.Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
|
|
||||||
resp.Header.Set("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization, Upgrade, Connection, Sec-WebSocket-Key, Sec-WebSocket-Version, Sec-WebSocket-Protocol, Sec-WebSocket-Extensions")
|
|
||||||
resp.Header.Set("Access-Control-Max-Age", "86400")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
mux.Handle(hn+"/", rp)
|
mux.Handle(hn+"/", rp)
|
||||||
addFaviconHandler(hn, mux)
|
addFaviconHandler(hn, mux)
|
||||||
continue
|
continue
|
||||||
@@ -508,14 +500,6 @@ func setProxy(mapping map[string]string) (http.Handler, error) {
|
|||||||
return net.DialTimeout(network, ba, 5*time.Second)
|
return net.DialTimeout(network, ba, 5*time.Second)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ModifyResponse: func(resp *http.Response) error {
|
|
||||||
// Add CORS headers to all proxied responses
|
|
||||||
resp.Header.Set("Access-Control-Allow-Origin", "*")
|
|
||||||
resp.Header.Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
|
|
||||||
resp.Header.Set("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization, Upgrade, Connection, Sec-WebSocket-Key, Sec-WebSocket-Version, Sec-WebSocket-Protocol, Sec-WebSocket-Extensions")
|
|
||||||
resp.Header.Set("Access-Control-Max-Age", "86400")
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
ErrorLog: log2.New(os.Stderr, "reverse", 0),
|
ErrorLog: log2.New(os.Stderr, "reverse", 0),
|
||||||
BufferPool: bufPool{},
|
BufferPool: bufPool{},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user