Skip to content

Commit

Permalink
napi: proxy wsrpc
Browse files Browse the repository at this point in the history
  • Loading branch information
baabeetaa committed Sep 2, 2023
1 parent 93f7c3e commit d362eeb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions notionalapi/proxy/generate_upstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ for service_name in $SERVICES; do
server $gw_ip:26657;
}
upstream backend_wsrpc_$service_name {
keepalive 16;
server $gw_ip:26658;
}
upstream backend_api_$service_name {
keepalive 16;
server $gw_ip:1317;
Expand Down
13 changes: 13 additions & 0 deletions notionalapi/proxy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ http {
deny all;
}

location ~* ^/websocket {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header x-api-key ${xapikey};

proxy_pass http://backend_wsrpc_${chain_name};
}

if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
Expand Down

0 comments on commit d362eeb

Please sign in to comment.