Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/2-features/nginz-deeplink
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow configuring nginz so it serve the deeplink for apps to discover the backend
15 changes: 15 additions & 0 deletions charts/nginz/templates/conf/_deeplink.html.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- define "nginz_deeplink.html" }}
{{/* See https://docs.wire.com/how-to/associate/deeplink.html
(or search for "deeplink" on docs.wire.com)
for details on use of the deeplink*/}}
<html>
<head></head>
<body>
{{- if hasKey .Values.nginx_conf "deeplink" }}
<a href="wire://access/?config={{ .Values.nginx_conf.deeplink.endpoints.backendURL }}/deeplink.json">Click here for access</a>
{{- else }}
No Deep Link.
{{- end }}
</body>
</html>
{{- end }}
24 changes: 24 additions & 0 deletions charts/nginz/templates/conf/_deeplink.json.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- define "nginz_deeplink.json" }}
{{- if hasKey .Values.nginx_conf "deeplink" }}
{{- with .Values.nginx_conf.deeplink }}
{{/* See https://docs.wire.com/how-to/associate/deeplink.html
(or search for "deeplink" on docs.wire.com)
for details on use of the deeplink*/}}
{
"endpoints" : {
{{- with .endpoints }}
"backendURL" : {{ .backendURL | quote }},
"backendWSURL": {{ .backendWSURL | quote }},
"blackListURL": {{ .blackListURL | quote }},
"teamsURL": {{ .teamsURL | quote }},
"accountsURL": {{ .accountsURL | quote }},
"websiteURL": {{ .websiteURL | quote }}
{{- end }}
},
"title" : {{ .title | quote }}
}
{{- end }}
{{- else }}
{}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/nginz/templates/conf/_nginx.conf.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,25 @@ http {
image/png png;
}
}

{{- if hasKey .Values.nginx_conf "deeplink" }}
location ~* ^/deeplink.(json|html)$ {
zauth off;
root /etc/wire/nginz/conf/;
types {
application/json json;
text/html html;
}
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Methods' "GET, OPTIONS";
add_header 'Access-Control-Allow-Headers' "$http_access_control_request_headers, DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type";
add_header 'Content-Type' 'text/plain; charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
more_set_headers 'Access-Control-Allow-Origin: $http_origin';
}
{{- end }}
}
}
{{- end }}
4 changes: 4 additions & 0 deletions charts/nginz/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ data:
{{- include "nginz_upstreams.txt" . | indent 4 }}
zwagger-config.js: |2
{{- include "nginz_zwagger-config.js" . | indent 4 }}
deeplink.json: |2
{{- include "nginz_deeplink.json" . | indent 4 }}
deeplink.html: |2
{{- include "nginz_deeplink.html" . | indent 4 }}
{{ (.Files.Glob "conf/static/*").AsConfig | indent 2 }}
kind: ConfigMap
metadata:
Expand Down
9 changes: 9 additions & 0 deletions charts/nginz/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ nginx_conf:
worker_rlimit_nofile: 131072
worker_connections: 65536
swagger_root: /var/www/swagger
# deeplink:
# endpoints:
# backendURL: "https://prod-nginz-https.wire.com"
# backendWSURL: "https://prod-nginz-ssl.wire.com"
# blackListURL: "https://clientblacklist.wire.com/prod"
# teamsURL: "https://teams.wire.com"
# accountsURL: "https://accounts.wire.com"
# websiteURL: "https://wire.com"
# title: "Production"
disabled_paths:
- /conversations/last-events
- ~* ^/conversations/([^/]*)/knock
Expand Down