]> Untitled Git - godot-builder.git/blob - nginx/conf.d/godot.conf
3acaff1c805dff9d9341e2e73d78be42c2383f6a
[godot-builder.git] / nginx / conf.d / godot.conf
1 server {
2     listen  80;
3     root    /build;
4     index   index.html;
5
6     location / {
7         autoindex on;
8     }
9
10     #------------------------------------------------
11     # Adds required support for Godot 4 WebGL Support
12     #------------------------------------------------
13     location ~ .+/web/ {
14         add_header Cross-Origin-Resource-Policy same-origin;
15         add_header Cross-Origin-Opener-Policy same-origin;
16         add_header Cross-Origin-Embedder-Policy require-corp;
17     }
18
19     #----------------------------------
20     # Unity WebGL Support
21     #----------------------------------
22
23     # On-disk Brotli-precompressed data files should be served with compression enabled:
24     location ~ .+\.(data|symbols\.json)\.br$ {
25         # Because this file is already pre-compressed on disk, disable the on-demand compression on it.
26         # Otherwise nginx would attempt double compression.
27         gzip off;
28         add_header Content-Encoding br;
29         default_type application/octet-stream;
30     }
31
32     # On-disk Brotli-precompressed JavaScript code files:
33     location ~ .+\.js\.br$ {
34         gzip off; # Do not attempt dynamic gzip compression on an already compressed file
35         add_header Content-Encoding br;
36         default_type application/javascript;
37     }
38
39     # On-disk Brotli-precompressed WebAssembly files:
40     location ~ .+\.wasm\.br$ {
41         gzip off; # Do not attempt dynamic gzip compression on an already compressed file
42         add_header Content-Encoding br;
43         # Enable streaming WebAssembly compilation by specifying the correct MIME type for
44         # Wasm files.
45         default_type application/wasm;
46     }
47
48     # On-disk gzip-precompressed data files should be served with compression enabled:
49     location ~ .+\.(data|symbols\.json)\.gz$ {
50         gzip off; # Do not attempt dynamic gzip compression on an already compressed file
51         add_header Content-Encoding gzip;
52         default_type application/octet-stream;
53     }
54
55     # On-disk gzip-precompressed JavaScript code files:
56     location ~ .+\.js\.gz$ {
57         gzip off; # Do not attempt dynamic gzip compression on an already compressed file
58         add_header Content-Encoding gzip;
59         default_type application/javascript;
60     }
61
62     # On-disk gzip-precompressed WebAssembly files:
63     location ~ .+\.wasm\.gz$ {
64         gzip off; # Do not attempt dynamic gzip compression on an already compressed file
65         add_header Content-Encoding gzip;
66         # Enable streaming WebAssembly compilation by specifying the correct MIME type for
67         # Wasm files.
68         default_type application/wasm;
69     }
70 }