@platformatic/gateway 3.44.0 → 3.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.d.ts +2 -0
- package/lib/capability.js +7 -2
- package/lib/proxy.js +9 -3
- package/lib/schema.js +2 -0
- package/package.json +7 -7
- package/schema.json +7 -1
package/config.d.ts
CHANGED
package/lib/capability.js
CHANGED
|
@@ -41,8 +41,13 @@ export class GatewayCapability extends ServiceCapability {
|
|
|
41
41
|
|
|
42
42
|
const url = await super.start()
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
// Only register the runtime event handler once. start() can be called
|
|
45
|
+
// multiple times (first with listen:false, then listen:true) so guard
|
|
46
|
+
// against duplicate registrations.
|
|
47
|
+
if (!this.#runtimeEventHandler) {
|
|
48
|
+
this.#runtimeEventHandler = this.#handleRuntimeEvent.bind(this)
|
|
49
|
+
globalThis[kITC]?.on('runtime:event', this.#runtimeEventHandler)
|
|
50
|
+
}
|
|
46
51
|
|
|
47
52
|
return url
|
|
48
53
|
}
|
package/lib/proxy.js
CHANGED
|
@@ -31,7 +31,7 @@ async function resolveApplicationProxyParameters (application, root) {
|
|
|
31
31
|
|
|
32
32
|
// If no prefix could be found, assume the application id
|
|
33
33
|
let prefix = (application.proxy?.prefix ?? meta.prefix ?? application.id).replace(/(\/$)/g, '')
|
|
34
|
-
let rewritePrefix = ''
|
|
34
|
+
let rewritePrefix = application.proxy?.rewritePrefix ?? ''
|
|
35
35
|
let internalRewriteLocationHeader = true
|
|
36
36
|
|
|
37
37
|
if (meta.wantsAbsoluteUrls) {
|
|
@@ -44,8 +44,14 @@ async function resolveApplicationProxyParameters (application, root) {
|
|
|
44
44
|
|
|
45
45
|
// The rewritePrefix purposely ignores application.proxy?.prefix to let
|
|
46
46
|
// the application always being able to configure their value
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
if (!application.proxy?.rewritePrefix) {
|
|
48
|
+
rewritePrefix = meta.prefix ?? application.id
|
|
49
|
+
internalRewriteLocationHeader = false
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (typeof application.proxy?.rewriteLocationHeader === 'boolean') {
|
|
54
|
+
internalRewriteLocationHeader = application.proxy.rewriteLocationHeader
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
const require = createRequire(import.meta.filename)
|
package/lib/schema.js
CHANGED
|
@@ -149,6 +149,8 @@ export const gateway = {
|
|
|
149
149
|
},
|
|
150
150
|
upstream: { type: 'string' },
|
|
151
151
|
prefix: { type: 'string' },
|
|
152
|
+
rewritePrefix: { type: 'string' },
|
|
153
|
+
rewriteLocationHeader: { type: 'boolean' },
|
|
152
154
|
hostname: { type: 'string' },
|
|
153
155
|
custom: {
|
|
154
156
|
type: 'object',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/gateway",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.46.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"typescript": "^5.5.4",
|
|
33
33
|
"why-is-node-running": "2",
|
|
34
34
|
"ws": "^8.16.0",
|
|
35
|
-
"@platformatic/db": "3.
|
|
35
|
+
"@platformatic/db": "3.46.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@fastify/error": "^4.0.0",
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
"rfdc": "^1.3.1",
|
|
64
64
|
"semgrator": "^0.3.0",
|
|
65
65
|
"undici": "^7.0.0",
|
|
66
|
-
"@platformatic/basic": "3.
|
|
67
|
-
"@platformatic/
|
|
68
|
-
"@platformatic/
|
|
69
|
-
"@platformatic/service": "3.
|
|
70
|
-
"@platformatic/telemetry": "3.
|
|
66
|
+
"@platformatic/basic": "3.46.0",
|
|
67
|
+
"@platformatic/scalar-theme": "3.46.0",
|
|
68
|
+
"@platformatic/foundation": "^3.46.0",
|
|
69
|
+
"@platformatic/service": "3.46.0",
|
|
70
|
+
"@platformatic/telemetry": "3.46.0"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/gateway/3.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/gateway/3.46.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Gateway Config",
|
|
5
5
|
"type": "object",
|
|
@@ -837,6 +837,12 @@
|
|
|
837
837
|
"prefix": {
|
|
838
838
|
"type": "string"
|
|
839
839
|
},
|
|
840
|
+
"rewritePrefix": {
|
|
841
|
+
"type": "string"
|
|
842
|
+
},
|
|
843
|
+
"rewriteLocationHeader": {
|
|
844
|
+
"type": "boolean"
|
|
845
|
+
},
|
|
840
846
|
"hostname": {
|
|
841
847
|
"type": "string"
|
|
842
848
|
},
|