Skip to content

Instantly share code, notes, and snippets.

@bensig
Last active February 23, 2019 10:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bensig/3c02deee490d6b4915d994e5c30bea64 to your computer and use it in GitHub Desktop.
Save bensig/3c02deee490d6b4915d994e5c30bea64 to your computer and use it in GitHub Desktop.
nginx virtualhost config for separating EOS history API - redirect 416 errors to greymass
upstream nodeos-full-history {
server eos.greymass.com:80;
}
upstream nodeos-full-history-ssl {
server eos.greymass.com:443;
}
upstream nodeos-limited-history {
server node1.yourdomain.io:port;
server node2.yourdomain.io:port backup;
server node3.yourdomain.io:port backup;
}
server {
listen 80;
server_name api.sheos.org;
access_log off;
location / {
rewrite ^/(.*) http://yourdomain.io permanent;
}
location /v1/ {
proxy_intercept_errors on;
error_page 416 = @history_upstream;
proxy_pass http://nodeos-limited-history;
}
location @history_upstream {
proxy_pass http://nodeos-full-history;
}
}
server {
listen 443 ssl;
server_name api.yourdomain.io;
access_log off;
location / {
rewrite ^/(.*) https://yourdomain.io permanent;
}
location @history_upstream {
proxy_pass https://nodeos-full-history-ssl;
}
ssl_certificate /etc/letsencrypt/live/api.yourdomain.io/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/api.yourdomain.io/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location /v1/ {
proxy_intercept_errors on;
error_page 416 = @history_upstream;
proxy_pass http://nodeos-limited-history;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment