Merge pull request #19203 from vector-im/add-cache-control-nginx

Return cache-control: no-cache from Docker nginx for /
This commit is contained in:
James Salter 2021-09-29 11:44:49 +01:00 committed by GitHub
commit 54c2e8fc8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -33,5 +33,8 @@ COPY --from=builder /src/webapp /app
# Insert wasm type into Nginx mime.types file so they load correctly. # Insert wasm type into Nginx mime.types file so they load correctly.
RUN sed -i '3i\ \ \ \ application/wasm wasm\;' /etc/nginx/mime.types RUN sed -i '3i\ \ \ \ application/wasm wasm\;' /etc/nginx/mime.types
# Override default nginx config
COPY /nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
RUN rm -rf /usr/share/nginx/html \ RUN rm -rf /usr/share/nginx/html \
&& ln -s /app /usr/share/nginx/html && ln -s /app /usr/share/nginx/html

18
nginx/conf.d/default.conf Normal file
View File

@ -0,0 +1,18 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
# Set no-cache for the index.html only so that browsers always check for a new copy of Element Web.
location = /index.html {
add_header Cache-Control "no-cache";
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
}