consensus/docker/nginx/site.conf
DataHoarder 55661a12da
All checks were successful
continuous-integration/drone/push Build is passing
WIP: Bootstrap-based responsive interface, CSS only
2024-03-20 13:37:26 +01:00

123 lines
3.3 KiB
Plaintext

upstream api-keepalive {
server api:8080;
keepalive 32;
}
upstream web-keepalive {
server web:8444;
keepalive 32;
}
upstream daemon-keepalive {
server daemon:8787;
keepalive 32;
}
server {
listen 80 fastopen=200 default_server;
access_log /dev/null;
error_log /dev/null;
server_name _;
root /web;
proxy_connect_timeout 60;
proxy_read_timeout 120;
max_ranges 1;
tcp_nodelay on;
gzip on;
gzip_types text/html text/css text/xml text/plain text/javascript text/xml application/xml application/x-javascript application/javascript application/json image/svg+xml application/font-woff application/font-woff2 application/font-ttf application/octet-stream application/wasm;
gzip_min_length 1000;
gzip_proxied no_etag;
gzip_comp_level 5;
gzip_disable "MSIE [1-6]\.";
server_tokens off;
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
absolute_redirect off;
rewrite ^/c/(.*)$ /api/redirect/coinbase/$1 last;
rewrite ^/t/(.*)$ /api/redirect/transaction/$1 last;
rewrite ^/b/(.*)$ /api/redirect/block/$1 last;
rewrite ^/s/(.*)$ /api/redirect/share/$1 last;
rewrite ^/p/(.*)$ /api/redirect/prove/$1 last;
rewrite ^/m/(.*)$ /api/redirect/miner/$1 last;
try_files $uri $uri/ @web;
include snippets/onion-headers.conf;
location = / {
proxy_pass http://web-keepalive;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
add_header Allow "GET, POST";
include snippets/security-headers.conf;
include snippets/csp.conf;
include snippets/onion-headers.conf;
}
location = /api {
proxy_pass http://web-keepalive;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
add_header Allow "GET, POST";
include snippets/security-headers.conf;
include snippets/csp.conf;
include snippets/onion-headers.conf;
}
location = /api/events {
proxy_pass http://daemon-keepalive;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
add_header Cache-Control "no-store";
include snippets/security-headers.conf;
include snippets/csp.conf;
include snippets/onion-headers.conf;
}
location @web {
proxy_pass http://web-keepalive;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
add_header Allow "GET, POST";
include snippets/security-headers.conf;
include snippets/csp.conf;
include snippets/onion-headers.conf;
}
location ^~ /api/ {
proxy_pass http://api-keepalive;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
add_header Allow "HEAD, OPTIONS, GET, POST";
include snippets/security-headers.conf;
include snippets/cors.conf;
include snippets/onion-headers.conf;
}
location ~* \.(jpg|jpeg|png|webp|gif|svg|ico|css|js|mjs|xml|woff|ttf|ttc|wasm|data|mem)$ {
add_header Cache-Control "public, max-age=2592000"; # 30 days
gzip on;
sendfile on;
}
}