mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
websocket fix attempt#2
This commit is contained in:
parent
668639e484
commit
21b67e97af
1 changed files with 6 additions and 2 deletions
|
@ -20,12 +20,16 @@ func Stats(cfg *config.Config, w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
func StatsWS(cfg *config.Config, w http.ResponseWriter, r *http.Request) {
|
||||
originPats := cfg.Value().MatchDomains
|
||||
localAddresses := []string{"127.0.0.1", "10.0.*.*", "172.16.*.*", "192.168.*.*"}
|
||||
originPats := make([]string, len(cfg.Value().MatchDomains)+len(localAddresses))
|
||||
|
||||
if len(originPats) == 0 {
|
||||
U.Logger.Warnf("no match domains configured, accepting websocket request from all origins")
|
||||
originPats = []string{"*"}
|
||||
} else {
|
||||
localAddresses := []string{"127.0.0.1", "10.0.*.*", "172.16.*.*", "192.168.*.*"}
|
||||
for i, domain := range cfg.Value().MatchDomains {
|
||||
originPats[i] = "*." + domain
|
||||
}
|
||||
originPats = append(originPats, localAddresses...)
|
||||
}
|
||||
if common.IsDebug {
|
||||
|
|
Loading…
Add table
Reference in a new issue