Skip to content

Commit d727d59

Browse files
fix(frontend): opensearch.xml available under root (#133)
resolves #89
1 parent 4bce5fd commit d727d59

File tree

6 files changed

+18
-26
lines changed

6 files changed

+18
-26
lines changed

Phonebook.Frontend/.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
!nginx
1313
!substitute_variables.sh
1414
!globals.js
15-
!version.js
15+
!version.js
16+
!opensearch.xml

Phonebook.Frontend/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ RUN chmod +x ./substitute_variables.sh
4040

4141
RUN rm /usr/share/nginx/html/index.html
4242
COPY --from=builder /usr/local/app/dist /usr/share/nginx/html
43+
COPY ./opensearch.xml /usr/share/nginx/html/opensearch.xml
4344

4445
ENTRYPOINT ["./substitute_variables.sh", "/usr/share/nginx/html", "./substitute_variables.sh", "/etc/nginx"]
4546
CMD ["nginx"]

Phonebook.Frontend/nginx/nginx.conf

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,19 @@ http {
6969

7070
add_header X-Frame-Options "DENY";
7171

72-
location /status {
73-
stub_status;
72+
location = /opensearch.xml {
73+
alias /usr/share/nginx/html/opensearch.xml;
7474
}
7575

76-
location /ngsw.json {
76+
location = /ngsw.json {
7777
return 404;
7878
}
7979

80-
location /de/ngsw.json {
80+
location = /de/ngsw.json {
8181
return 404;
8282
}
8383

84-
location /en/ngsw.json {
84+
location = /en/ngsw.json {
8585
return 404;
8686
}
8787

@@ -96,9 +96,6 @@ http {
9696
try_files $uri $uri/ /en/index.html;
9797
}
9898

99-
location /health {
100-
return 200;
101-
}
10299

103100
location / {
104101
if ($cookie_lang = "de") {
@@ -110,13 +107,6 @@ http {
110107
rewrite ^(.*)$ /$lang/$1 redirect;
111108
}
112109

113-
# error_page 404 /404.html;
114-
# location = /40x.html {
115-
# }
116-
117-
# error_page 500 502 503 504 /50x.html;
118-
# location = /50x.html {
119-
# }
120110
}
121111

122112
# Catch All
@@ -129,10 +119,14 @@ http {
129119
return 444;
130120
}
131121

132-
location /health {
122+
location = /health {
133123
return 200;
134124
}
135125

126+
location = /status {
127+
stub_status;
128+
}
129+
136130
location / {
137131
# catch all unless more specific location match
138132
return 301 $scheme://${SERVER_NAME}$request_uri;

Phonebook.Frontend/src/assets/opensearch.xml renamed to Phonebook.Frontend/opensearch.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
The Phonebook. Search for any employee.
77
</Description>
88
<InputEncoding>UTF-8</InputEncoding>
9-
<Image width="16" height="16" type="image/x-icon">${BASE_URL}/favicon.ico</Image>
10-
<Url type="text/html" template="${BASE_URL}/search/{searchTerms}"/>
9+
<Image width="16" height="16" type="image/x-icon">${BASE_URL}favicon.ico</Image>
10+
<Url type="text/html" template="${BASE_URL}search/{searchTerms}"/>
11+
<Url type="application/opensearchdescription+xml" rel="self" template="${BASE_URL}opensearch.xml" />
1112
</OpenSearchDescription>

Phonebook.Frontend/src/index.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@
1818
</script>
1919
<base href="/" />
2020
<!-- Opensearch Compatibility https://stackoverflow.com/questions/7630144/how-to-add-google-chrome-omnibox-search-support-for-your-site -->
21-
<link
22-
rel="search"
23-
type="application/opensearchdescription+xml"
24-
title="Phonebook Search"
25-
href="assets/opensearch.xml"
26-
/>
21+
<link rel="search" type="application/opensearchdescription+xml" title="Phonebook Search" href="/opensearch.xml" />
2722

2823
<link rel="manifest" href="manifest.webmanifest" />
2924
<meta name="theme-color" content="#1976d2" />

Phonebook/phonebook/templates/frontend-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ spec:
4141
initialDelaySeconds: 6
4242
env:
4343
- name: BASE_URL
44-
value: "https://{{ .Values.host }}"
44+
value: "https://{{ .Values.host }}/"
4545
- name: ROOMPLANNINGTOOL_URL
4646
value: "{{ .Values.roomPlanningToolUrl }}"
4747
- name: CONTACT_URL

0 commit comments

Comments
 (0)