Skip to content

Commit 7cdb44e

Browse files
authored
Add bison trails nginx config (#56)
* Add bison trails nginx proxy config * Update https for rpc providers with Bison Trails
1 parent 5abf887 commit 7cdb44e

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

doc/https-for-rpc-providers.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ This lack will be remedied in a future release but in order to address the probl
1212
| 7901 | Figment | HTTP RPC and websocket |
1313
| 7802 | TritonOne | websocket only |
1414
| 7902 | TritonOne | HTTP RPC and websocket |
15+
| 7803 | BisonTrails | websocket only |
16+
| 7903 | BisonTrails | HTTP RPC and websocket |
1517

1618
## Running `nginx` as a standalone, unprivileged process
1719

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#
2+
# Bison Trails configuration snippet
3+
#
4+
# Can be included directly in /etc/nginx/sites-available/ (Debian based distros)
5+
# or /etc/nginx/conf.d/ (Red Hat based distros)
6+
#
7+
# Bison Trails currently only supports http basic authentication. To
8+
# get the basic auth digest, you need to use the base64 encoded version
9+
# of USERNAME:PASSWORD.
10+
#
11+
# From a linux machine, you can do this replacing USERNAME and PASSWORD
12+
# with the credentials from the bison trails QT "API Access" tab:
13+
#
14+
# echo USERNAME:PASSWORD | base64 -w0
15+
#
16+
# Use the base64 encoded value for REPLACE_ME_WITH_YOUR_AUTH_TOKEN.
17+
#
18+
# YOUR_SERVER and REPLACE_ME_WITH_YOUR_AUTH_TOKEN should be replaced with the
19+
# appropriate values for your organization
20+
#
21+
22+
# Bison Trails RPC & websocket with auth
23+
server {
24+
listen 7903;
25+
26+
# Remove "https://" and any trailing slash e.g. 977c2599-63f9-4c6b-9eed-49dada416a3f.solana.bison.run
27+
set $upstream_host YOUR_SERVER;
28+
set $basic_auth_digest REPLACE_ME_WITH_YOUR_AUTH_TOKEN;
29+
30+
location / {
31+
try_files /nonexistent-used-for-try-testing @$http_upgrade;
32+
}
33+
34+
location @websocket {
35+
proxy_pass https://$upstream_host/ws$request_uri;
36+
proxy_http_version 1.1;
37+
proxy_set_header Host $proxy_host;
38+
# websocket requirements
39+
proxy_set_header Upgrade $http_upgrade;
40+
proxy_set_header Connection "Upgrade";
41+
# Bison Trails specific authentication requirement
42+
proxy_set_header Authorization "Basic $basic_auth_digest";
43+
proxy_redirect https://$proxy_host http://$server_name:$server_port;
44+
proxy_redirect https:// http://;
45+
}
46+
47+
location @ {
48+
proxy_pass https://$upstream_host/rpc$request_uri;
49+
proxy_http_version 1.1;
50+
proxy_set_header Host $proxy_host;
51+
proxy_set_header Connection "";
52+
# Bison Trails specific authentication requirement
53+
proxy_set_header Authorization "Basic $basic_auth_digest";
54+
proxy_redirect https://$proxy_host http://$server_name:$server_port;
55+
proxy_redirect https:// http://;
56+
}
57+
}
58+
59+
#
60+
# This is a separate port for handling only websocket connections that some developers
61+
# have found greatly eases debugging. It provides the same functionality as the first
62+
# location stanza in the virtual server above.
63+
#
64+
65+
server {
66+
listen 7803;
67+
68+
set $upstream_host YOUR_SERVER;
69+
set $basic_auth_digest REPLACE_ME_WITH_YOUR_AUTH_TOKEN;
70+
71+
location / {
72+
proxy_pass https://$upstream_host/ws$request_uri;
73+
proxy_http_version 1.1;
74+
proxy_set_header Host $proxy_host;
75+
# websocket requirements
76+
proxy_set_header Upgrade $http_upgrade;
77+
proxy_set_header Connection "Upgrade";
78+
# Bison Trails specific authentication requirement
79+
proxy_set_header Authorization "Basic $basic_auth_digest";
80+
proxy_redirect https://$proxy_host http://$server_name:$server_port;
81+
proxy_redirect https:// http://;
82+
}
83+
}

0 commit comments

Comments
 (0)