新增跨域
This commit is contained in:
parent
e921b7912c
commit
08f7879a06
@ -17,6 +17,7 @@ cors:
|
|||||||
- "http://127.0.0.1:5173"
|
- "http://127.0.0.1:5173"
|
||||||
- "https://global-interaction.com"
|
- "https://global-interaction.com"
|
||||||
- "https://www.global-interaction.com"
|
- "https://www.global-interaction.com"
|
||||||
|
- "https://h5.global-interaction.com"
|
||||||
- "https://api.global-interaction.com"
|
- "https://api.global-interaction.com"
|
||||||
allowed_methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
|
allowed_methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
|
||||||
allowed_headers:
|
allowed_headers:
|
||||||
|
|||||||
@ -14,6 +14,7 @@ cors:
|
|||||||
allowed_origins:
|
allowed_origins:
|
||||||
- "https://global-interaction.com"
|
- "https://global-interaction.com"
|
||||||
- "https://www.global-interaction.com"
|
- "https://www.global-interaction.com"
|
||||||
|
- "https://h5.global-interaction.com"
|
||||||
- "https://api.global-interaction.com"
|
- "https://api.global-interaction.com"
|
||||||
allowed_methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
|
allowed_methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
|
||||||
allowed_headers:
|
allowed_headers:
|
||||||
|
|||||||
@ -17,6 +17,7 @@ cors:
|
|||||||
- "http://127.0.0.1:5173"
|
- "http://127.0.0.1:5173"
|
||||||
- "https://global-interaction.com"
|
- "https://global-interaction.com"
|
||||||
- "https://www.global-interaction.com"
|
- "https://www.global-interaction.com"
|
||||||
|
- "https://h5.global-interaction.com"
|
||||||
- "https://api.global-interaction.com"
|
- "https://api.global-interaction.com"
|
||||||
allowed_methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
|
allowed_methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
|
||||||
allowed_headers:
|
allowed_headers:
|
||||||
|
|||||||
@ -244,6 +244,7 @@ func Default() Config {
|
|||||||
"http://127.0.0.1:5173",
|
"http://127.0.0.1:5173",
|
||||||
"https://global-interaction.com",
|
"https://global-interaction.com",
|
||||||
"https://www.global-interaction.com",
|
"https://www.global-interaction.com",
|
||||||
|
"https://h5.global-interaction.com",
|
||||||
"https://api.global-interaction.com",
|
"https://api.global-interaction.com",
|
||||||
},
|
},
|
||||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||||
|
|||||||
@ -22,7 +22,7 @@ func TestLoad(t *testing.T) {
|
|||||||
if cfg.RoomServiceAddr != "127.0.0.1:13001" {
|
if cfg.RoomServiceAddr != "127.0.0.1:13001" {
|
||||||
t.Fatalf("unexpected room addr: %s", cfg.RoomServiceAddr)
|
t.Fatalf("unexpected room addr: %s", cfg.RoomServiceAddr)
|
||||||
}
|
}
|
||||||
if !cfg.CORS.Enabled || !containsString(cfg.CORS.AllowedOrigins, "https://global-interaction.com") || !containsString(cfg.CORS.AllowedHeaders, "X-App-Code") {
|
if !cfg.CORS.Enabled || !containsString(cfg.CORS.AllowedOrigins, "https://h5.global-interaction.com") || !containsString(cfg.CORS.AllowedHeaders, "X-App-Code") {
|
||||||
t.Fatalf("unexpected cors config: %+v", cfg.CORS)
|
t.Fatalf("unexpected cors config: %+v", cfg.CORS)
|
||||||
}
|
}
|
||||||
if cfg.GRPCClient.DefaultTimeout != 5*time.Second || cfg.GRPCClient.RetryMaxAttempts != 2 || len(cfg.GRPCClient.RetryableStatusCodes) != 1 || cfg.GRPCClient.RetryableStatusCodes[0] != "UNAVAILABLE" {
|
if cfg.GRPCClient.DefaultTimeout != 5*time.Second || cfg.GRPCClient.RetryMaxAttempts != 2 || len(cfg.GRPCClient.RetryableStatusCodes) != 1 || cfg.GRPCClient.RetryableStatusCodes[0] != "UNAVAILABLE" {
|
||||||
@ -67,7 +67,7 @@ func TestLoadTencentExample(t *testing.T) {
|
|||||||
if cfg.TencentIM.CallbackURL == "" {
|
if cfg.TencentIM.CallbackURL == "" {
|
||||||
t.Fatalf("callback_url template must be present")
|
t.Fatalf("callback_url template must be present")
|
||||||
}
|
}
|
||||||
if !cfg.CORS.Enabled || !containsString(cfg.CORS.AllowedOrigins, "https://global-interaction.com") || cfg.CORS.MaxAgeSec != 600 {
|
if !cfg.CORS.Enabled || !containsString(cfg.CORS.AllowedOrigins, "https://h5.global-interaction.com") || cfg.CORS.MaxAgeSec != 600 {
|
||||||
t.Fatalf("tencent cors template must be explicit: %+v", cfg.CORS)
|
t.Fatalf("tencent cors template must be explicit: %+v", cfg.CORS)
|
||||||
}
|
}
|
||||||
if cfg.AppConfig.MySQLDSN == "" || !strings.Contains(cfg.AppConfig.MySQLDSN, "hyapp_admin") {
|
if cfg.AppConfig.MySQLDSN == "" || !strings.Contains(cfg.AppConfig.MySQLDSN, "hyapp_admin") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user