Skip to content

Commit

Permalink
update allowed origins list and nginx config (#4730)
Browse files Browse the repository at this point in the history
* update allowed origins list

Signed-off-by: Shovan Maity <[email protected]>

* update nginx config

Signed-off-by: Shovan Maity <[email protected]>

* add manifest changes

Signed-off-by: Shovan Maity <[email protected]>

* update local value of allowed origins

Signed-off-by: Shovan Maity <[email protected]>

---------

Signed-off-by: Shovan Maity <[email protected]>
  • Loading branch information
shovanmaity committed Jun 27, 2024
1 parent 16ea8cb commit 544d324
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 39 deletions.
2 changes: 1 addition & 1 deletion chaoscenter/authentication/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Config struct {
DbServer string `required:"true" split_words:"true"`
DbUser string `required:"true" split_words:"true"`
DbPassword string `required:"true" split_words:"true"`
AllowedOrigins []string `split_words:"true" default:"litmuschaos.io?,localhost:([0-9]+)?"`
AllowedOrigins []string `split_words:"true" default:"^(http:https://|https://|)litmuschaos.io(:[0-9]+|)?,^(http:https://|https://|)localhost(:[0-9]+|)"`
}

var config Config
Expand Down
2 changes: 1 addition & 1 deletion chaoscenter/graphql/server/utils/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Configuration struct {
CustomChaosHubPath string `split_words:"true" default:"/tmp/"`
DefaultChaosHubPath string `split_words:"true" default:"/tmp/default/"`
EnableGQLIntrospection string `split_words:"true" default:"false"`
AllowedOrigins []string `split_words:"true" default:"litmuschaos.io?,localhost:([0-9]+)?"`
AllowedOrigins []string `split_words:"true" default:"^(http:https://|https://|)litmuschaos.io(:[0-9]+|)?,^(http:https://|https://|)localhost(:[0-9]+|)"`
}

var Config Configuration
13 changes: 4 additions & 9 deletions chaoscenter/manifests/litmus-cluster-scope.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,6 @@ data:
}
location /api/ {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass "http:https://litmusportal-server-service:9002/";
}
location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
Expand Down Expand Up @@ -313,6 +304,8 @@ spec:
value: "5000000"
- name: INFRA_COMPATIBLE_VERSIONS
value: '["ci"]'
- name: ALLOWED_ORIGINS
value: ^(http:https://|https://|)litmuschaos.io(:[0-9]+|)?,^(http:https://|https://|)litmusportal-server-service(:[0-9]+|)?
ports:
- containerPort: 8080
- containerPort: 8000
Expand Down Expand Up @@ -387,6 +380,8 @@ spec:
value: "litmusportal-server-service"
- name: LITMUS_GQL_GRPC_PORT
value: ":8000"
- name: ALLOWED_ORIGINS
value: ^(http:https://|https://|)litmuschaos.io(:[0-9]+|)?,^(http:https://|https://|)litmusportal-auth-server-service(:[0-9]+|)?
resources:
requests:
memory: "250Mi"
Expand Down
15 changes: 5 additions & 10 deletions chaoscenter/manifests/litmus-namespaced-scope.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@ data:
}
location /api/ {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass "http:https://litmusportal-server-service:9002/";
}
location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
Expand Down Expand Up @@ -288,7 +279,9 @@ spec:
- name: INGRESS_NAME
value: "litmus-ingress"
- name: INFRA_COMPATIBLE_VERSIONS
value: '["ci"]'
value: '["ci"]'
- name: ALLOWED_ORIGINS
value: ^(http:https://|https://|)litmuschaos.io(:[0-9]+|)?,^(http:https://|https://|)litmusportal-server-service(:[0-9]+|)?
ports:
- containerPort: 8080
- containerPort: 8000
Expand Down Expand Up @@ -361,6 +354,8 @@ spec:
value: "litmusportal-server-service"
- name: LITMUS_GQL_GRPC_PORT
value: ":8000"
- name: ALLOWED_ORIGINS
value: ^(http:https://|https://|)litmuschaos.io(:[0-9]+|)?,^(http:https://|https://|)litmusportal-auth-server-service(:[0-9]+|)?
ports:
- containerPort: 3000
- containerPort: 3030
Expand Down
13 changes: 4 additions & 9 deletions chaoscenter/manifests/litmus-without-resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,6 @@ data:
}
location /api/ {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass "http:https://litmusportal-server-service:9002/";
}
location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
Expand Down Expand Up @@ -301,6 +292,8 @@ spec:
value: "5000000"
- name: INFRA_COMPATIBLE_VERSIONS
value: '["ci"]'
- name: ALLOWED_ORIGINS
value: ^(http:https://|https://|)litmuschaos.io(:[0-9]+|)?,^(http:https://|https://|)litmusportal-server-service(:[0-9]+|)?
ports:
- containerPort: 8080
- containerPort: 8000
Expand Down Expand Up @@ -366,6 +359,8 @@ spec:
value: "litmusportal-server-service"
- name: LITMUS_GQL_GRPC_PORT
value: ":8000"
- name: ALLOWED_ORIGINS
value: ^(http:https://|https://|)litmuschaos.io(:[0-9]+|)?,^(http:https://|https://|)litmusportal-auth-server-service(:[0-9]+|)?
ports:
- containerPort: 3000
- containerPort: 3030
Expand Down
9 changes: 0 additions & 9 deletions chaoscenter/web/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,6 @@ http {
}

location /api/ {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass "http:https://litmusportal-server-service:9002/";
}

location /ws/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
Expand Down

0 comments on commit 544d324

Please sign in to comment.