File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,12 @@ KUEUE_VIZ_PORT=8181 ./kueue_ws_app
41
41
42
42
## Variables
43
43
44
- | Environment variables | Description | Default value |
45
- | --------------------- | ------------------------ | ------------- |
46
- | ` KUEUE_VIZ_PORT ` | Default application port | 8080 |
47
- | ` GIN_MODE ` | Gin mode | debug |
44
+
45
+ | Environment variables | Description | Default value |
46
+ | -------------------------- | ------------------------------------ | ------------- |
47
+ | ` KUEUE_VIZ_PORT ` | Default application port | 8080 |
48
+ | ` GIN_MODE ` | Gin mode | debug |
49
+ | ` KUEUEVIZ_ALLOWED_ORIGINS ` | Comma-separated list of CORS origins | ` * ` (dev only)|
48
50
49
51
## Endpoints
50
52
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ import (
31
31
32
32
// validateOrigin validates and sanitizes a CORS origin URL
33
33
func validateOrigin (origin string ) (string , bool ) {
34
+ // Special case for wildcard origin
35
+ if origin == "*" {
36
+ return "*" , true
37
+ }
38
+
34
39
u , err := url .Parse (origin )
35
40
if err != nil {
36
41
return "" , false
@@ -44,6 +49,7 @@ func validateOrigin(origin string) (string, bool) {
44
49
return "" , false
45
50
}
46
51
52
+ // Only include scheme and host (which includes port if specified)
47
53
cleanOrigin := fmt .Sprintf ("%s://%s" , u .Scheme , u .Host )
48
54
return cleanOrigin , true
49
55
}
@@ -70,10 +76,7 @@ func ConfigureCORS() (cors.Config, error) {
70
76
} else {
71
77
// Default development origins (only in development mode)
72
78
if gin .Mode () != gin .ReleaseMode {
73
- allowedOrigins = []string {
74
- "http://localhost:3000" ,
75
- "http://127.0.0.1:3000" ,
76
- }
79
+ allowedOrigins = append (allowedOrigins , "*" )
77
80
log .Println ("KUEUEVIZ_ALLOWED_ORIGINS not set, using default development origins" )
78
81
} else {
79
82
log .Println ("Production mode: KUEUEVIZ_ALLOWED_ORIGINS must be explicitly set" )
You can’t perform that action at this time.
0 commit comments