You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix blocking publish route
* Added common routes
* Default to open - which was the previous functionality
* Update spacetimedb-standalone.md
* Update spacetimedb-standalone.md
* Updated with support for the typescript SDK
* Updated with known good subscribe route
* Updated doc text
* Clarified comment
* nit
Copy file name to clipboardExpand all lines: docs/deploying/spacetimedb-standalone.md
+47-7
Original file line number
Diff line number
Diff line change
@@ -82,29 +82,69 @@ server {
82
82
listen 80;
83
83
server_name example.com;
84
84
85
-
location / {
85
+
#########################################
86
+
# By default SpacetimeDB is completely open so that anyone can publish to it. If you want to block
87
+
# users from creating new databases you should keep this section commented out. Otherwise, if you
88
+
# want to open it up (probably for dev environments) then you can uncomment this section and then
89
+
# also comment out the location / section below.
90
+
#########################################
91
+
# location / {
92
+
# proxy_pass http://localhost:3000;
93
+
# proxy_http_version 1.1;
94
+
# proxy_set_header Upgrade $http_upgrade;
95
+
# proxy_set_header Connection "Upgrade";
96
+
# proxy_set_header Host $host;
97
+
# }
98
+
99
+
# Anyone can subscribe to any database.
100
+
# Note: This is the only section *required* for the websocket to function properly. Clients will
101
+
# be able to create identities, call reducers, and subscribe to tables through this websocket.
102
+
location ~ ^/v1/database/[^/]+/subscribe$ {
86
103
proxy_pass http://localhost:3000;
87
104
proxy_http_version 1.1;
88
105
proxy_set_header Upgrade $http_upgrade;
89
106
proxy_set_header Connection "Upgrade";
90
107
proxy_set_header Host $host;
91
108
}
92
109
93
-
# This restricts who can publish new databases to your SpacetimeDB instance. We recommend
94
-
# restricting this ability to local connections.
95
-
location /v1/publish {
96
-
allow 127.0.0.1;
97
-
deny all;
110
+
# Uncomment this section to allow all HTTP reducer calls
111
+
# location ~ ^/v1/[^/]+/call/[^/]+$ {
112
+
# proxy_pass http://localhost:3000;
113
+
# proxy_http_version 1.1;
114
+
# proxy_set_header Upgrade $http_upgrade;
115
+
# proxy_set_header Connection "Upgrade";
116
+
# proxy_set_header Host $host;
117
+
# }
118
+
119
+
# Uncomment this section to allow all HTTP sql requests
120
+
# location ~ ^/v1/[^/]+/sql$ {
121
+
# proxy_pass http://localhost:3000;
122
+
# proxy_http_version 1.1;
123
+
# proxy_set_header Upgrade $http_upgrade;
124
+
# proxy_set_header Connection "Upgrade";
125
+
# proxy_set_header Host $host;
126
+
# }
127
+
128
+
# NOTE: This is required for the typescript sdk to function, it is optional
129
+
# for the rust and the C# SDKs.
130
+
location /v1/identity {
98
131
proxy_pass http://localhost:3000;
99
132
proxy_http_version 1.1;
100
133
proxy_set_header Upgrade $http_upgrade;
101
134
proxy_set_header Connection "Upgrade";
102
135
proxy_set_header Host $host;
103
136
}
137
+
138
+
# Block all other routes explicitly. Only localhost can use these routes. If you want to open your
139
+
# server up so that anyone can publish to it you should comment this section out.
140
+
location / {
141
+
allow 127.0.0.1;
142
+
deny all;
143
+
}
104
144
}
105
145
```
106
146
107
-
This configuration contains a restriction to the `/v1/publish` route. This restriction makes it so that you can only publish to the database if you're publishing from a local connection on the host.
147
+
This configuration by default blocks all connections other than `/v1/identity` and `/v1/database/<database-name>/subscribe` which only allows the most basic functionality. This will prevent all remote users from publishing to your SpacetimeDB instance.
0 commit comments