Repository navigation
Expand file tree
/
Copy pathnginx.conf
More file actions
42 lines (35 loc) · 1.61 KB
/
Copy pathnginx.conf
File metadata and controls
42 lines (35 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# TLS terminates at the proxy in front of this container, so nginx only ever
# sees plain HTTP. Absolute redirects would therefore send visitors (and
# Googlebot) from https:// to http://. Keep Location headers relative.
absolute_redirect off;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/css application/javascript application/json application/wasm image/svg+xml text/plain application/xml;
location /assets/ {
try_files $uri =404;
add_header Cache-Control "public, max-age=31536000, immutable";
}
# /playground, /embed, the tool pages, and the article pages are canonical
# without a trailing slash; fold the slashed variant into it so only one URL
# gets indexed. Keep the tool list in step with TOOL_PATHS in src/lib/routes.ts.
location ~ ^/(playground|embed|lua-formatter|luau-type-checker|luau-bytecode-viewer|lua|luau|lua-vs-luau|lua-5-1-vs-5-4|lua-pattern-tester|lua-table-to-json|(?:examples|learn-luau)(?:/[a-z0-9-]+)?)/$ {
return 301 /$1$is_args$args;
}
# The service worker must never be served stale, or a deploy can't replace it.
location = /sw.js {
add_header Cache-Control "no-cache";
}
# $uri/index.html serves the prerendered route pages (dist/playground/index.html)
# directly, instead of nginx's directory handling redirecting /playground to /playground/.
# Without this, browsers cache pages on a heuristic and show the old build after a deploy.
location / {
add_header Cache-Control "no-cache";
try_files $uri $uri/index.html /index.html;
}
}