Created
August 10, 2020 20:20
-
-
Save novy4/0f02f3b7f4990bc4fc813bb5817038e5 to your computer and use it in GitHub Desktop.
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
upstream mainnet { | |
server 127.0.0.1:8545; | |
} | |
upstream mainnetws { | |
server 127.0.0.1:8546; | |
} | |
server { | |
listen 18181; | |
access_log /var/log/nginx/parity.log; | |
proxy_http_version 1.1; | |
proxy_connect_timeout 360; | |
proxy_read_timeout 360; | |
proxy_pass_header Date; | |
proxy_pass_header Server; | |
proxy_pass_header Authorization; | |
proxy_set_header Accept-Encoding ""; | |
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_pass_request_headers on; | |
proxy_buffering off; | |
proxy_set_header Connection "Keep-Alive"; | |
proxy_redirect off; | |
location /mainnet/secretc0de { | |
proxy_pass http://mainnet; | |
} | |
location /ws/mainnet/secretc0de { | |
if ($request_method = OPTIONS) { | |
return 204; | |
} | |
auth_basic off; | |
add_header Access-Control-Allow-Origin "$http_origin"; | |
add_header Access-Control-Allow-Headers "authorization, content-type"; | |
add_header Access-Control-Allow-Methods "DELETE, GET, OPTIONS, POST, PUT, UPDATE"; | |
# to avoid double origin value what leads to an CORS error in the browser | |
proxy_hide_header Access-Control-Allow-Origin; | |
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; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_pass http://mainnetws; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment