-
-
Save aaroncox/0394c457215677d7e6432f9b3a180bc3 to your computer and use it in GitHub Desktop.
EOS Light History API configuration in nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############# | |
# File Location: /etc/nginx/sites-enabled/default | |
############# | |
# The Light EOS History API | |
upstream nodeos-lighthistory { | |
server 127.0.0.1:8888 fail_timeout=15s; | |
} | |
# The Full EOS History API | |
upstream nodeos-fullhistory { | |
server eos.greymass.com fail_timeout=15s; | |
} | |
server { | |
listen 80; | |
server_name _; | |
root /var/www/html/; | |
access_log off; | |
keepalive_timeout 120; | |
keepalive_requests 50000; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
include /etc/nginx/proxy_headers.conf; | |
location / { | |
include /etc/nginx/proxy_headers.conf; | |
proxy_intercept_errors on; | |
error_page 416 = @history_failover; | |
proxy_pass http://nodeos-lighthistory; | |
} | |
location @history_failover { | |
include /etc/nginx/proxy_headers.conf; | |
proxy_next_upstream error timeout invalid_header; | |
proxy_pass http://nodeos-fullhistory; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############# | |
# File Location: /etc/nginx/proxy_headers.conf | |
############# | |
add_header 'Access-Control-Allow-Origin' '*' always; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; | |
add_header 'Access-Control-Allow-Headers' 'X-Requested-With,Accept,Content-Type,Origin' always; | |
add_header Host $host; | |
add_header Upgrade $http_upgrade; | |
add_header X-Cached $upstream_cache_status always; | |
proxy_hide_header 'Access-Control-Allow-Origin'; | |
proxy_hide_header 'Access-Control-Allow-Headers'; | |
proxy_hide_header 'Via'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment