Commit a027a7dd authored by Jeffrey Morgan's avatar Jeffrey Morgan
Browse files

add `0.0.0.0` as an allowed origin by default

Fixes #282
parent 22986ccb
...@@ -323,7 +323,6 @@ func CopyModelHandler(c *gin.Context) { ...@@ -323,7 +323,6 @@ func CopyModelHandler(c *gin.Context) {
func Serve(ln net.Listener, extraOrigins []string) error { func Serve(ln net.Listener, extraOrigins []string) error {
config := cors.DefaultConfig() config := cors.DefaultConfig()
config.AllowWildcard = true config.AllowWildcard = true
// only allow http/https from localhost
allowedOrigins := []string{ allowedOrigins := []string{
"http://localhost", "http://localhost",
"http://localhost:*", "http://localhost:*",
...@@ -333,6 +332,10 @@ func Serve(ln net.Listener, extraOrigins []string) error { ...@@ -333,6 +332,10 @@ func Serve(ln net.Listener, extraOrigins []string) error {
"http://127.0.0.1:*", "http://127.0.0.1:*",
"https://127.0.0.1", "https://127.0.0.1",
"https://127.0.0.1:*", "https://127.0.0.1:*",
"http://0.0.0.0",
"http://0.0.0.0:*",
"https://0.0.0.0",
"https://0.0.0.0:*",
} }
allowedOrigins = append(allowedOrigins, extraOrigins...) allowedOrigins = append(allowedOrigins, extraOrigins...)
config.AllowOrigins = allowedOrigins config.AllowOrigins = allowedOrigins
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment