refactor: remove unnecessary include statements from nginx configuration and update connection handling in API server
rabbitprincess committed
Jun 1, 2026 at 01:02 UTC
8b158c4a15d766aefd109e9c21c9b9dc239dcc4c
4 files changed
+4
-7
docs/static/examples/nginx-proxy-multi-service/nginx.conf
-2
@@ -18,8 +18,6 @@ worker_processes auto;
18
error_log /var/log/nginx/error.log;
19
pid /run/nginx.pid;
20
21
-include /usr/share/nginx/modules/*.conf;
22
-
21
events {
22
worker_connections 1024;
23
}
nginx.conf.template
-2
@@ -10,8 +10,6 @@
10
# The browser-facing certificate is read from ./.portal-certs by docker-compose.
11
# That is the same default directory used by the relay certificate.
12
13
-include /usr/share/nginx/modules/*.conf;
14
-
13
events {
14
worker_connections 4096;
15
}
portal/api_server.go
+1
-1
@@ -548,7 +548,7 @@ func (s *Server) handleConnect(w http.ResponseWriter, r *http.Request) {
548
return
549
}
550
551
- if _, err := rw.WriteString("HTTP/1.1 200 OK\r\nContent-Length: 0\r\nConnection: keep-alive\r\n\r\n"); err != nil {
551
+ if _, err := rw.WriteString("HTTP/1.1 101 Switching Protocols\r\nUpgrade: raw\r\nConnection: Upgrade\r\n\r\n"); err != nil {
552
_ = conn.Close()
553
return
554
}
sdk/listener.go
+3
-2
@@ -592,7 +592,8 @@ func (l *listener) openReverseSession(ctx context.Context) (net.Conn, error) {
592
Header: make(http.Header),
593
}
594
req.Header.Set(types.HeaderAccessToken, lease.accessToken)
595
- req.Header.Set("Connection", "keep-alive")
595
+ req.Header.Set("Connection", "Upgrade")
596
+ req.Header.Set("Upgrade", "raw")
597
598
if writeErr := req.Write(conn); writeErr != nil {
599
_ = conn.Close()
@@ -607,7 +608,7 @@ func (l *listener) openReverseSession(ctx context.Context) (net.Conn, error) {
608
}
609
defer resp.Body.Close()
610
610
- if resp.StatusCode != http.StatusOK {
611
+ if resp.StatusCode != http.StatusSwitchingProtocols {
612
apiErr := utils.DecodeAPIRequestError(resp)
613
_ = conn.Close()
614
return nil, apiErr