summaryrefslogtreecommitdiff
path: root/deploy/nginx-yesod.conf
blob: dc9404bd47a9501289837a1b1b8545d04dff60e0 (plain)
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
# Yesod at https://example.org/vr/ (any path works: the app only uses
# relative URLs). Include this from your site's TLS server block; it proxies to
# the Node app on PORT (8095 by default).
#
# Nothing about visitors is logged here: no access log (who loaded the page,
# when, from where), and only critical errors, which don't name visitors.
location = /vr {
    access_log off;
    error_log /dev/null crit;
    return 301 /vr/;
}

location /vr/ {
    access_log off;
    error_log /dev/null crit;

    proxy_pass http://127.0.0.1:8095/;
    proxy_http_version 1.1;

    # socket.io upgrades to a WebSocket for signaling.
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_read_timeout 1h;
    proxy_send_timeout 1h;
    client_max_body_size 16k;

    # Compress scripts, JSON and 3D models (.glb, and .vrm which is served as
    # octet-stream): the libraries shrink ~75%, avatars and hands 50-85%.
    # Images are already compressed and left alone.
    gzip on;
    gzip_proxied any;
    gzip_vary on;
    gzip_comp_level 5;
    gzip_min_length 1024;
    gzip_types application/javascript text/css application/json model/gltf-binary application/octet-stream;
}