Files
aego/deploy/nginx.conf
T

92 lines
2.3 KiB
Nginx Configuration File

map $arg_v $aego_cache {
"" "public, max-age=300";
default "public, max-age=31536000, immutable";
}
map $http_accept_encoding $aego_br {
"~*\bbr\b" ".br";
default "";
}
map $aego_br $aego_br_encoding {
".br" "br";
default "";
}
map $uri $aego_coop {
"~^/play/" "same-origin";
default "";
}
map $uri $aego_coep {
"~^/play/" "require-corp";
default "";
}
map $sent_http_content_type $aego_page_cache {
"~^text/html" "public, max-age=60";
default $aego_cache;
}
server {
listen 80;
root /usr/share/nginx/html;
gzip_static on;
gzip_vary on;
absolute_redirect off;
location = /healthz {
default_type text/plain;
return 200 "ok";
}
location ~ \.wasm$ {
types { }
default_type application/wasm;
add_header Cache-Control $aego_cache;
add_header Content-Encoding $aego_br_encoding;
add_header Vary Accept-Encoding;
add_header Cross-Origin-Opener-Policy $aego_coop;
add_header Cross-Origin-Embedder-Policy $aego_coep;
try_files $uri$aego_br $uri =404;
}
location ~ ^/install\.(sh|ps1)$ {
default_type text/plain;
add_header Cache-Control "no-cache";
}
# Pages live at clean URLs; /a/index.html -> /a/, /a/b.html -> /a/b.
location ~ \.html$ {
if ($request_uri ~ "^(.*/)index\.html(\?.*)?$") {
return 301 $1$is_args$args;
}
if ($request_uri ~ "^(.+)\.html(\?.*)?$") {
return 301 $1$is_args$args;
}
add_header Cache-Control "public, max-age=60";
add_header Cross-Origin-Opener-Policy $aego_coop;
add_header Cross-Origin-Embedder-Policy $aego_coep;
try_files $uri =404;
}
location ~ \.json$ {
add_header Cache-Control "public, max-age=60";
add_header Cross-Origin-Opener-Policy $aego_coop;
add_header Cross-Origin-Embedder-Policy $aego_coep;
try_files $uri =404;
}
location = / {
add_header Cache-Control "public, max-age=60";
try_files /index.html =404;
}
location / {
add_header Cache-Control $aego_page_cache;
add_header Cross-Origin-Opener-Policy $aego_coop;
add_header Cross-Origin-Embedder-Policy $aego_coep;
try_files $uri $uri.html $uri/ =404;
}
}