Skip to content

Commit 8d34a0f

Browse files
authored
fix: remove long poll router for realtime (#4344)
* chore: replace kong lambda with expression * fix: remove long poll router for realtime
1 parent 15ecc83 commit 8d34a0f

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

internal/start/start.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,14 @@ EOF
358358
// default JWT for downstream services.
359359
// Finally, the apikey header may be set to a legacy JWT. In that case, we want to copy
360360
// it to Authorization header for backwards compatibility.
361-
`$((function() return (headers.authorization ~= nil and headers.authorization:sub(1, 10) ~= 'Bearer sb_' and headers.authorization) or (headers.apikey == '%s' and 'Bearer %s') or (headers.apikey == '%s' and 'Bearer %s') or headers.apikey end)())`,
361+
`$((headers.authorization ~= nil and headers.authorization:sub(1, 10) ~= 'Bearer sb_' and headers.authorization) or (headers.apikey == '%s' and 'Bearer %s') or (headers.apikey == '%s' and 'Bearer %s') or headers.apikey)`,
362362
utils.Config.Auth.SecretKey.Value,
363363
utils.Config.Auth.ServiceRoleKey.Value,
364364
utils.Config.Auth.PublishableKey.Value,
365365
utils.Config.Auth.AnonKey.Value,
366366
),
367367
QueryToken: fmt.Sprintf(
368-
`$((function() return (query_params.apikey == '%s' and '%s') or (query_params.apikey == '%s' and '%s') or query_params.apikey end)())`,
368+
`$((query_params.apikey == '%s' and '%s') or (query_params.apikey == '%s' and '%s') or query_params.apikey)`,
369369
utils.Config.Auth.SecretKey.Value,
370370
utils.Config.Auth.ServiceRoleKey.Value,
371371
utils.Config.Auth.PublishableKey.Value,

internal/start/templates/kong.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -113,25 +113,6 @@ services:
113113
replace:
114114
querystring:
115115
- "apikey:{{ .QueryToken }}"
116-
- name: realtime-v1-longpoll-not-working
117-
_comment: "Realtime: /realtime/v1/* -> ws://realtime:4000/socket/longpoll"
118-
url: http://{{ .RealtimeId }}:4000/socket
119-
protocol: http
120-
routes:
121-
- name: realtime-v1-longpoll
122-
strip_path: true
123-
paths:
124-
- /realtime/v1/
125-
plugins:
126-
- name: cors
127-
- name: request-transformer
128-
config:
129-
add:
130-
headers:
131-
- "Authorization: {{ .BearerToken }}"
132-
replace:
133-
headers:
134-
- "Authorization: {{ .BearerToken }}"
135116
- name: realtime-v1-rest
136117
_comment: "Realtime: /realtime/v1/* -> http://realtime:4000/api/*"
137118
url: http://{{ .RealtimeId }}:4000/api

0 commit comments

Comments
 (0)