aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/etc/nginx/conf.d/default.conf
blob: 88dcc0f2f3ab04d3d8a7adf9e5cb608d707d3869 (plain) (blame)
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
upstream backend {
    server 192.168.177.1:1234;
}

server {
    listen 80;
    listen [::]:80;

    root /usr/share/nginx/html;

    location / {
        index index.html;
    }

    location = /api/aliases {
        alias /data/aliases;
        default_type text/plain;
        # Disable caching?
        add_header Cache-Control no-store;
        add_header Last-Modified $date_gmt;
    }

    location ~ ^/api/(?<rpc_method>ListPeers|GetDeviceInfo)$ {
        proxy_set_header Content-Type application/json;
        proxy_set_header Referer "";
        proxy_method POST;
        proxy_set_body '{"jsonrpc": "2.0", "method": "$rpc_method", "params": {}}';
        proxy_pass http://backend;
    }
}