Skip to content

Commit

Permalink
use same nginx setup as emularity-engine
Browse files Browse the repository at this point in the history
  • Loading branch information
traceypooh committed Apr 9, 2024
1 parent ba4647d commit 8053060
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
4 changes: 3 additions & 1 deletion default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ 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 *;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
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;
}

Expand Down

0 comments on commit 8053060

Please sign in to comment.