mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-01-23 19:14:27 +00:00
feat(cors): ✨ add check for server port in CORS config
Some checks failed
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in -27m37s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in 55s
Build , Vet Test, and Lint / Lint Code (push) Successful in -27m0s
Build , Vet Test, and Lint / Build (push) Successful in -27m20s
Tests / Integration Tests (push) Failing after -27m54s
Tests / Unit Tests (push) Successful in 2m1s
Some checks failed
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in -27m37s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in 55s
Build , Vet Test, and Lint / Lint Code (push) Successful in -27m0s
Build , Vet Test, and Lint / Build (push) Successful in -27m20s
Tests / Integration Tests (push) Failing after -27m54s
Tests / Unit Tests (push) Successful in 2m1s
This commit is contained in:
@@ -26,10 +26,13 @@ func DefaultCORSConfig() CORSConfig {
|
|||||||
|
|
||||||
for i := range cfg.Servers.Instances {
|
for i := range cfg.Servers.Instances {
|
||||||
server := cfg.Servers.Instances[i]
|
server := cfg.Servers.Instances[i]
|
||||||
|
if server.Port == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
hosts = append(hosts, server.ExternalURLs...)
|
||||||
hosts = append(hosts, fmt.Sprintf("http://%s:%d", server.Host, server.Port))
|
hosts = append(hosts, fmt.Sprintf("http://%s:%d", server.Host, server.Port))
|
||||||
hosts = append(hosts, fmt.Sprintf("https://%s:%d", server.Host, server.Port))
|
hosts = append(hosts, fmt.Sprintf("https://%s:%d", server.Host, server.Port))
|
||||||
hosts = append(hosts, fmt.Sprintf("http://%s:%d", "localhost", server.Port))
|
hosts = append(hosts, fmt.Sprintf("http://%s:%d", "localhost", server.Port))
|
||||||
hosts = append(hosts, server.ExternalURLs...)
|
|
||||||
for _, ip := range ipsList {
|
for _, ip := range ipsList {
|
||||||
hosts = append(hosts, fmt.Sprintf("http://%s:%d", ip.String(), server.Port))
|
hosts = append(hosts, fmt.Sprintf("http://%s:%d", ip.String(), server.Port))
|
||||||
hosts = append(hosts, fmt.Sprintf("https://%s:%d", ip.String(), server.Port))
|
hosts = append(hosts, fmt.Sprintf("https://%s:%d", ip.String(), server.Port))
|
||||||
|
|||||||
Reference in New Issue
Block a user