diff --git a/Dockerfile b/Dockerfile index ee97f6e..48280a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,7 @@ FROM nginx:alpine WORKDIR /usr/share/nginx/html -RUN rm -f index.html && \ - # xxx not great for files that dont end like: .js.gz .wasm.gz - sed -i 's/js;/js gz;/' /etc/nginx/mime.types +RUN rm -f index.html COPY default.conf /etc/nginx/conf.d/ diff --git a/default.conf b/default.conf index 728de58..45123c1 100644 --- a/default.conf +++ b/default.conf @@ -29,7 +29,7 @@ server { add_header Vary Origin; } - # customization - like above but with `Content-Encoding` header + # customization - like 1st location, but with `Content-Type` & `Content-Encoding` headers location ~\.(js|wasm)\.gz$ { root /usr/share/nginx/html; add_header Access-Control-Allow-Origin *; @@ -37,6 +37,8 @@ server { add_header Access-Control-Allow-Headers Accept-Encoding,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,DNT,Pragma,Range,X-Requested-With; add_header Vary Origin; + types { } + default_type application/javascript; add_header Content-Encoding gzip; }