forked from mempool/mempool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx-mempool.conf
69 lines (57 loc) · 1.69 KB
/
nginx-mempool.conf
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
access_log /var/log/nginx/access_mempool.log;
error_log /var/log/nginx/error_mempool.log;
root /var/www/mempool/browser;
index index.html;
# enable browser and proxy caching
add_header Cache-Control "public, no-transform";
# vary cache if user changes language preference
add_header Vary Accept-Language;
add_header Vary Cookie;
# fallback for all URLs i.e. /address/foo /tx/foo /block/000
location / {
try_files /$lang/$uri /$lang/$uri/ $uri $uri/ /en-US/$uri @index-redirect;
expires 10m;
}
location /resources {
try_files $uri @index-redirect;
expires 1h;
}
# only cache /resources/config.* for 5 minutes since it changes often
location /resources/config. {
try_files $uri =404;
expires 5m;
}
location @index-redirect {
rewrite (.*) /$lang/index.html;
}
# location block using regex are matched in order
# used for cookie override
location ~ ^/(ar|bg|bs|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh|hi)/ {
try_files $uri $uri/ /$1/index.html =404;
}
# static API docs
location = /api {
try_files $uri $uri/ /en-US/index.html =404;
}
location = /api/ {
try_files $uri $uri/ /en-US/index.html =404;
}
location /api/v1/ws {
proxy_pass http://127.0.0.1:8999/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /api/v1 {
proxy_pass http://127.0.0.1:8999/api/v1;
}
location /api/ {
proxy_pass http://127.0.0.1:8999/api/v1/;
}
# mainnet API
location /ws {
proxy_pass http://127.0.0.1:8999/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}