upstream rpc_cache { server 127.0.0.1:26657; } upstream rest_cache { server 127.0.0.1:1317; } upstream ws-backend { ip_hash; server 127.0.0.1:26657; } upstream grpc_cache { server 127.0.0.1:8080; } # seed/peer server { listen 80; listen [::]:80; server_name ; location / { proxy_pass http://0.0.0.0:26656; 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; # WebSocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } # rpc server { server_name ; # websocket connection here (We convert wss to ws so we do not have to deal with certs) location /websocket { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_pass http://ws-backend/websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location / { add_header Access-Control-Max-Age 3600; add_header Access-Control-Expose-Headers Content-Length; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header X-NginX-Proxy true; add_header Referrer-Policy 'origin'; proxy_pass http://rpc_cache; # WebSocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } # api server { server_name ; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; add_header Referrer-Policy 'origin'; # handled in the config # add_header Access-Control-Allow-Origin *; # add_header Access-Control-Allow-Methods *; add_header Access-Control-Max-Age 3600; add_header Access-Control-Expose-Headers Content-Length; proxy_pass http://rest_cache; } } # grpc server { server_name ; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; add_header Referrer-Policy 'origin'; # handled in the config # add_header Access-Control-Allow-Origin *; # add_header Access-Control-Allow-Methods *; add_header Access-Control-Max-Age 3600; add_header Access-Control-Expose-Headers Content-Length; proxy_pass http://grpc_cache; } }