Skip to content

Commit

Permalink
WPB-9495: nginz: add allowlisted_fqdn_origins override (#4087)
Browse files Browse the repository at this point in the history
* add allowlisted_fqdn_origins override
* this is required to get CORS to work with additional developer domains
* included a test to prevent usage of allowlisted_fqdn_origins in non-staging environments

related to WPB-9495
  • Loading branch information
lwille authored Jun 10, 2024
1 parent 520964b commit 99c4092
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/5-internal/WPB-9495
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nginz: Added `allowlisted_fqdn_origins` to `nginx_conf` value
9 changes: 8 additions & 1 deletion charts/nginz/templates/conf/_nginx.conf.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,14 @@ http {
{{ range $origin := .Values.nginx_conf.randomport_allowlisted_origins }}
"~^https?://{{ $origin }}(:[0-9]{2,5})?$" "$http_origin";
{{ end }}
}
{{/* Allow additional origin FQDNs, if present */}}
{{- range $origin := .Values.nginx_conf.allowlisted_fqdn_origins }}
"https://{{ $origin }}" "$http_origin";
{{- end }}
{{- if and .Values.nginx_conf.allowlisted_fqdn_origins (not (eq .Values.nginx_conf.env "staging")) -}}
{{ fail "allowlisted_fqdn_origins is only cleared for usage in staging."}}
{{- end }}
}


#
Expand Down
3 changes: 3 additions & 0 deletions charts/nginz/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ nginx_conf:
- webapp
- teams
- account
# Fully-qualified domain names from which to allow Cross-Origin Requests
# (they are **not** combined with 'external_env_domain')
allowlisted_fqdn_origins: []

# The origins from which we allow CORS requests at random ports. This is
# useful for testing with HTTP proxies and should not be used in production.
Expand Down

0 comments on commit 99c4092

Please sign in to comment.